Hello All,

Well as I continue to work on Video Conference app project I have been
playing with
I have run into a problem I cannot answer.

Hopefully someone can give me some direction here from the RED5 mail list.

Thanks for any and all responses.

Lenny
*************************************************************************

Here's my situation:

Flex Client code:

// Check the user name length
   if( txtName.text.length > 0 ) {
    // Create Connection and setup Events
    nc = new NetConnection();
    nc.client = this;
    nc.objectEncoding = ObjectEncoding.AMF3;
    nc.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );

//     var identifier:String = txtName.text;
    identifier = txtName.text
< - For testing purposes I always enter Lenny as txtName for Login
    while( identifier.search( " " ) > 0 )
     identifier = identifier.replace( " ", "_" );
    nc.connect( "rtmp://10.2.0.10/videoconf", txtName.text, identifier );

    } else {
    Alert.show( "Please provide a name for the video chat connection!" );
   }
  }


public function netStatusHandler( event:NetStatusEvent ):void
  {
   Logger.debug( "MAIN:connectionSuccess:Success" );
   trace("This is the event.info.code "+ event.info.code);
   switch( event.info.code ) {
    case "NetConnection.Connect.Success":                                 <
- Always returns NetConnection.Connect.Success
     // Connection succeeded now create components

     connectComponents();
< - Then proceeds to this call
     // Change to Video view
     vsMain.selectedChild =
pnlVideo;                                             < - After this call
the app proceeds to usersSyncHandler( event:SyncEvent ): which is refernced
in

                                in
connectComponents()
    break;
    case "NetConnection.Connect.Rejected":
     Alert.show( "The number of users has been limited for this demo,
please try again in a few minutes.", "Restricted Usage" );
    break;
   }
  }
****************************************************************
/**
   * Method called to create the components
*/

  public function
connectComponents():void                                                <
-      The next call
  {
   // Simple User shared object and event handling
   SharedObject.defaultObjectEncoding  = flash.net.ObjectEncoding.AMF3;
   users_so = SharedObject.getRemote("users_so", nc.uri, false);
   trace("the users shared object" + users_so);
   if(users_so){
      users_so.addEventListener(SyncEvent.SYNC,
usersSyncHandler);                 < - This is the next call
after connectComponents(): users_so.addEventListener
      users_so.client = this
      users_so.connect(nc);
   }
   trace("user_so textName " + txtName.text);
< - Displays the login name : Lenny
   trace("user_so identifier " +
identifier);
< - Display the identifier name : Lenny
  }

The following is the next call in the Flex client where everything seems to
stop:

My question here is do I need an nc.call to get the txtName and identifier
into the event.target.data or do I need an users_so.send()?
If so, what would be the proper nc.call function or a users_so.send call to
retrieve this info?
Please excuse me if you this the answer is basic and should be simple to
arrive at but I've been looking at this app so
long that things are now starting to run together. : )

/**
   * Listens for any change to the users shared object
*/
  public function usersSyncHandler( event:SyncEvent ):void
  {

   trace( "MAIN:usersSyncHandler" + event.target.data );    < -
shows MAIN:usersSyncHandler[object
Object] in the trace window in Flex

was thinking that txtName: Lenny and identifier: Lenny would show in
event.target.data
   trace("usersSyncHandler " + event.changeList);              < -  again
shows usersSyncHandler [object Object] in the trace window in Flex
   var results:Object = event.target.data;
   trace( "results" + results );
< - again shows results[object Object]
   var usersArray:Array = new Array();
   for( var a:String in results )
{                                           < - does nothing and skips down
to dpUsers
    var obj:Object = new Object();
    obj.name = results[ a ];
    obj.identifier = a;
    usersArray.push( obj );
   }
   dpUsers = new ArrayCollection( usersArray );
   trace("dpUsers :" + dpUsers);                                         <
- dpUsers is empty and this is where the app exits the dispatchevents
    }

*********************************************************************************************************************************************************

Application.java

public boolean appStart(IScope app) {
 appScope = app;
 //add users

 this.createSharedObject(this.appScope, "users_so", true);
 log.debug("@Application.java: appStart is called from Application.");

 return true;
}


/** [EMAIL PROTECTED] */
   @Override
public boolean appConnect(IConnection conn, Object[] params) {
 // Trigger calling of "onBWDone", required for some FLV players

 measureBandwidth(conn);

 String username = params[0].toString();
 String identifier = params[1].toString();

 log.debug("This are the params from Application - params[0]: " +
params[0]);  in the logs, this shows Lenny for the txtName
 log.debug("This are the params from Application - params[1]: " +
params[1]);  in the logs, this shows Lenny for the identifier
//  log.debug("This is the client in Application "+clientID);

 ServiceUtils.invokeOnConnection(conn, "setConnectionID", new Object[] {
conn.getClient().getId() } );
 log.debug("Elvis has entered the Conference and Joined from
Application:"); Just a test to see of things are running from the
Application.java file
 log.debug("This is the Connection ID :" + conn.getClient().getId()); displays
client id 0 when initial login

 IScope scope = conn.getScope();
 log.debug("This is the Scope in Application "+scope);

 ISharedObject users_so = this.getSharedObject(this.appScope, "users_so",
true);
 log.debug("appConnect is called from Application:  "+this.getSharedObject(
this.appScope, "users_so", true));

 return super.appConnect(conn, params);
}

}
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to