Expand my Community achievements bar.

looking for Flash example code

Avatar

Level 1

All the supplied examples are in Flex. I have a flash app I'd like to use cocomo/alccs in, but cannot find a single as3 Flash example. Can someone please post, or link to even a very simple login and chat example (libraries to include etc.) and I can work it out from there. Thanks in advance.

1 Reply

Avatar

Level 1

Hi new2oop,

I've been meaning to check out the Flash only version of ALCS, so you motivated me to do a little digging this morning.  That side of the library definitely isn't as developed as the Flex counterpart, so it may be some time until full documenation and examples are available.

Here is a simple app that establishes a connection and then loops a webcamera through the ALCS service, hopefully this helps you get started:

package {
    import com.adobe.rtc.authentication.AbstractAuthenticator;
    import com.adobe.rtc.authentication.AdobeHSAuthenticator;
    import com.adobe.rtc.collaboration.WebcamPublisher;
    import com.adobe.rtc.collaboration.WebcamSubscriber;
    import com.adobe.rtc.events.SessionEvent;
    import com.adobe.rtc.session.ConnectSession;
   
    import flash.display.Sprite;
   
    /**
     * Example ALCS Application which establishes a loop-back web camera.
     */
    public class AFCS_Flash_Version extends Sprite
    {
        protected var _authenticator:AbstractAuthenticator;
        protected var _connectSession:ConnectSession;
       
        public function AFCS_Flash_Version()
        {
            initializeALCS();
        }
       
        /**
         * Initializes and connects to the ALCS service.
         */
        protected function initializeALCS():void
        {
            _authenticator = new AdobeHSAuthenticator();
            _authenticator.userName = DebugCredentials.ALCS_USERNAME;
            _authenticator.password = DebugCredentials.ALCS_PASSWORD;
           
            _connectSession = new ConnectSession();
            _connectSession.authenticator = _authenticator;
            _connectSession.roomURL = DebugCredentials.ALCS_ROOM_URL;
            _connectSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onConnectionEstablished, false, 0, true);
            _connectSession.login();
        }
       
        /**
         * Handles succesful login into ALCS. Begins initializing components.
         */
        protected function onConnectionEstablished(e:SessionEvent):void
        {
            _connectSession.removeEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onConnectionEstablished);
           
            initializeVideo();
        }
       
        /**
         * Creates a webcam loopback and adds it to the display list.
         */
        protected function initializeVideo():void
        {
            var webcamPublisher:WebcamPublisher = new WebcamPublisher();
            webcamPublisher.subscribe();
            webcamPublisher.publish();
           
            var webcamSubscriber:WebcamSubscriber = new WebcamSubscriber();
            webcamSubscriber.webcamPublisher = webcamPublisher;
            webcamSubscriber.subscribe();
            this.addChild(webcamSubscriber);
        }
    }
}