Thanks this is a great resource but like the first post, when I cut
out the extras I get a whole bunch of errors. Ie cutting out the user
login. Has anyone done this?




<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
        xmlns="*"
        initialize="haveCamera = ( Camera.getCamera() != null )"
        layout="vertical">
        <mx:Script>
                <![CDATA[
                        import mx.collections.ArrayCollection;
                        import mx.controls.Alert;
                        
                        [Bindable]
                        private var haveCamera:Boolean;
                        
                        [Bindable]
                        public var nc:NetConnection;
                        
                        public var users_so:SharedObject;
                        [Bindable]
                        public var dpUsers:ArrayCollection;
                        
                        public function createConnection():void
                        {
                                if( txtName.text.length > 0 ) {
                                        nc = new NetConnection();
                                        nc.objectEncoding = ObjectEncoding.AMF0;
                                        nc.addEventListener( 
NetStatusEvent.NET_STATUS, netStatusHandler );
                                        var identifier:String = txtName.text;
                                        while( identifier.search( " " ) > 0 )
                                                identifier = 
identifier.replace( " ", "_" );
                                        nc.connect( 
"rtmp:/flex_videoconference/", txtName.text,
identifier );
                                } else {
                                        Alert.show( "Please provide a name for 
the video chat connection!" );
                                }
                        }
                        
                        public function netStatusHandler( event:NetStatusEvent 
):void
                        {
                                switch( event.info.code ) {
                                        case "NetConnection.Connect.Success":
                                                connectComponents();
                                                vsMain.selectedChild = pnlVideo;
                                        break;
                                }

                        }

                        public function connectComponents():void
                        {
                                SharedObject.defaultObjectEncoding  = 
flash.net.ObjectEncoding.AMF0;
                                users_so = SharedObject.getRemote("users_so", 
nc.uri, false);
                                users_so.addEventListener( SyncEvent.SYNC, 
usersSyncHandler );
                                users_so.connect( nc );
                        }

                        public function usersSyncHandler( event:SyncEvent ):void
                        {
                                var results:Object = event.target.data;
                                var usersArray:Array = new Array();
                                for( var a:String in results ) {
                                        var obj:Object = new Object();
                                        obj.name = results[ a ];
                                        obj.identifier = a;
                                        usersArray.push( obj );
                                }
                                dpUsers = new ArrayCollection( usersArray );
                        }

                        public function logout():void
                        {
                                users_so.close();
                                nc.close();
                                dpUsers = null;
                                users_so = null;
                                nc = null;
                                vsMain.selectedChild = pnlLogin;
                        }
                        
                ]]>
        </mx:Script>

        <mx:ViewStack
                id="vsMain"
                width="100%" height="100%">
                <!-- Login Panel -->
                <mx:Panel id="pnlLogin" roundedBottomCorners="true">
                        <mx:Form>
                                <mx:FormItem label="Name:">
                                        <mx:TextInput 
                                                id="txtName"
                                                enabled="{ haveCamera }" />
                                </mx:FormItem>
                                <mx:Button label="Connect"
                                        click="createConnection()"
                                        enabled="{ haveCamera }" />
                                <mx:Label text="{ ( haveCamera ) ? '':'Now 
camera is found!' }" />
                        </mx:Form>
                </mx:Panel>
                <!-- Video Panel -->
                <mx:Panel id="pnlVideo"
                        width="100%" height="100%"
                        title="Welcome { txtName.text }!"
                        layout="vertical">

                        <mx:Tile height="100%" width="100%">
                                <mx:Repeater id="rpUsers"
                                        dataProvider="{ dpUsers }">
                                        <VideoPod 
                                                nc="{ nc }"
                                                isSender="{ 
rpUsers.currentItem.name == txtName.text }"
                                                userItem="{ rpUsers.currentItem 
}" />
                                </mx:Repeater>
                        </mx:Tile>
                        <mx:ControlBar>
                                <mx:Button label="Disconnect"
                                        click="logout()"/>
                        </mx:ControlBar>
                </mx:Panel>
                
        </mx:ViewStack>

</mx:Application>






--- In [email protected], "greg h" <[EMAIL PROTECTED]> wrote:
>
> johnesocko,
> 
> This is not a direct answer to your question, just a suggestion of
another
> possible source for you to review.
> 
> Renaun published an article with sample code entitled:
> Video Conference with Flex & FMS:  Learn how to use Flex 2 and FMS 2 by
> creating a basic video conference application
> http://mxdj.sys-con.com/read/295379.htm
> 
> You can find links to a Live Demo and the Source Code here:
> http://renaun.com/blog/2006/10/28/139/
> 
> For additional support related to Flex w/ FMS, you might also want
to put
> your post up over on the FlashMedia list:
> http://www.flashcomguru.com/flashmedialist/
> 
> hth,
> 
> g
> 
> On 12/30/06, johnesocko <[EMAIL PROTECTED]> wrote:
> >
> > Does any one have a example (simple) of flex grabbing video and
> > playing it while using flash media server?
> >
> > http://flash-communications.net/technotes/fms2/flex2FMS/index.html
> >
> > I have gone through the all action script example of flex2FMS but I
> > can not figure out how to take out the local video part.
> >
> > ie localVideo = new Video(160, 120
> > ie instream
> >
> > Or how to add that to any other application.
> >
> > Thanks in advance for your help, or any direction.
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > Yahoo! Groups Links
> >
> >
> >
> >
>


Reply via email to