Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Personalizzare il componente simpleChat

Avatar

Not applicable

Ciao a tutti, sono nuovo e vorrei sapere come posso fare a personalizzare il componente SimpleChat.Utilizzo Flash Builder 4.5 e in design mode non mi fa vedere il componente. Come potrei fare ?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi There,

The first time you run the app, you should use your developer credentials -

this "unlocks" the features such as chat that you want to use.

See the 2nd VideoTutorial in the SDK Navigator application - "Managing

Roles and Permissions" - it explains why this works the way it does.

nigel

View solution in original post

4 Replies

Avatar

Level 10

Buongiorno,

(I have no idea how this arrived in my Inbox in english!)

I don't think design mode would really help you here anyhow. What are you trying to customize?

  One easy option is to build your own UI that sits on top of SimpleChatModel. Here's a quick example. You could build your own component that uses SimpleChatModel to show whatever you'd like for the UI - we encourage it, since we know our default UI isn't that exciting.

Nota bene : This example is at least 10 times easier in MX, since for whatever reason, the Spark folks decided displaying HTMLText in a textArea was too useful, and removed that functionality.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:session="com.adobe.rtc.session.*" xmlns:authentication="com.adobe.rtc.authentication.*">
     <fx:Script>
          <![CDATA[
               import com.adobe.rtc.sharedModel.descriptors.ChatMessageDescriptor;
              
               import spark.utils.TextFlowUtil;
          ]]>
     </fx:Script>
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <fx:Script>
          <![CDATA[
               import com.adobe.rtc.events.ChatEvent;
               import com.adobe.rtc.sharedModel.SimpleChatModel;
               [Bindable]
               protected var m_chatModel:SimpleChatModel = new SimpleChatModel();
              
               protected function init():void
               {
                    m_chatModel.sharedID = "myChat";
                    m_chatModel.subscribe();
                    m_chatModel.addEventListener(ChatEvent.HISTORY_CHANGE, onHistoryChange);
               }
              
               protected function onHistoryChange(p_evt:ChatEvent):void
               {
                    chatOutput.text += p_evt.message.displayName + ": " + p_evt.message.msg + "\n";
               }
              
               protected function sendMessage():void
               {
                    var chatMsg:ChatMessageDescriptor = new ChatMessageDescriptor();
                    chatMsg.msg = chatInput.text;
                    m_chatModel.sendMessage(chatMsg);
                    chatInput.text = "";
               }
          ]]>
     </fx:Script>


     <session:ConnectSessionContainer roomURL="https://collaboration.adobelivecycle.com/<account>/<room>" synchronizationChange="init()" width="100%" height="100%">
          <session:authenticator>
               <authentication:AdobeHSAuthenticator userName="<username>" password="<pass>"/>
          </session:authenticator>
          <s:TextArea id="chatOutput" width="300" height="400" editable="false"/>
          <s:TextInput id="chatInput" width="300" y="425" enter="sendMessage()"/>
     </session:ConnectSessionContainer>
    
</s:Application>

Grazie,

  nigel

Avatar

Not applicable

    Hi, I found your answer really successfully i used it but i have one problem with that code. I used this code ( i only delete the password, because i want make a chat for my site)

    flex return me this error "Main Thread (Suspended: Error: Error - insufficient permissions to create a new CollectionNode. You must be an OWNER of the room to add new multi-user features to it. Log in with developer credentials in order to do so.) "
    I have checked "Auto-Promote User" in the manage tab in the LCCS program. But this don't work because it return again the error.

    Sorry for my english
    If you have question about my english tell me.

    This is the code i used:

    i used this code

    <?xml version="1.0" encoding="utf-8"?>


    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"


                      xmlns:s="library://ns.adobe.com/flex/spark"


                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:session="com.adobe.rtc.session.*" xmlns:authentication="com.adobe.rtc.authentication.*">


         <fx:Script>


              <![CDATA[


                   import com.adobe.rtc.sharedModel.descriptors.ChatMessageDescriptor;


                   


                   import spark.utils.TextFlowUtil;


              ]]>


         </fx:Script>


         <fx:Declarations>


              <!-- Place non-visual elements (e.g., services, value objects) here -->


         </fx:Declarations>


         <fx:Script>


              <![CDATA[


                   import com.adobe.rtc.events.ChatEvent;


                   import com.adobe.rtc.sharedModel.SimpleChatModel;


                   [Bindable]


                   protected var m_chatModel:SimpleChatModel = new SimpleChatModel();


                   


                   protected function init():void


                   {


                        m_chatModel.sharedID = "myChat";


                        m_chatModel.subscribe();


                        m_chatModel.addEventListener(ChatEvent.HISTORY_CHANGE, onHistoryChange);


                   }


                   


                   protected function onHistoryChange(p_evt:ChatEvent):void


                   {


                        chatOutput.text += p_evt.message.displayName + ": " + p_evt.message.msg + "\n";


                   }


                   


                   protected function sendMessage():void


                   {


                        var chatMsg:ChatMessageDescriptor = new ChatMessageDescriptor();


                        chatMsg.msg = chatInput.text;


                        m_chatModel.sendMessage(chatMsg);


                        chatInput.text = "";


                   }


              ]]>


         </fx:Script>


         


         


         <session:ConnectSessionContainer roomURL="https://collaboration.adobelivecycle.com/<myaccount>/<myroom>
    " synchronizationChange="init()" width="100%" height="100%">

    <session:authenticator>

    <authentication:AdobeHSAuthenticator userName="Guest" />

    </session:authenticator>

    <s:TextArea id="chatOutput" width="300" height="400" editable="false"/>

    <s:TextInput id="chatInput" width="300" y="425" enter="sendMessage()"/>

    </session:ConnectSessionContainer>


    </s:Application>

    Avatar

    Correct answer by
    Level 10

    Hi There,

    The first time you run the app, you should use your developer credentials -

    this "unlocks" the features such as chat that you want to use.

    See the 2nd VideoTutorial in the SDK Navigator application - "Managing

    Roles and Permissions" - it explains why this works the way it does.

    nigel

    Avatar

    Not applicable

    Ty a lot for the answer. Now i see al video tutorial and i have resolved my problems ty again