Hi Pham, These are snippets of my as2 classfile which is attached to the movieclip. I hope this will help you.
You can also download Storm's famous videoconf app from http://www.red5tutorials.net/download/videoconf-storm/ The structure of his code (flash8 + as2 classes is the same). ruben /* This class takes care of the lobby chat functions/events */ import org.red5.net.Connection; import com.gskinner.events.GDispatcher; import org.red5.utils.Delegate; import mx.controls.Button; import mx.controls.TextArea; class LsdLobby extends MovieClip { public static var CLASS_REF = LsdLobby; public static var LINKAGE_ID:String = "LsdLobby"; // Public Properties: public var addEventListener:Function; public var removeEventListener:Function; public var nc:Connection; // Private Properties: private var dispatchEvent:Function; // Initialization: public function LsdLobby() { super(); GDispatcher.initialize(this); } private function onLoad() { nc = new Connection(); // connection for red5 nc.svr2flaLobbyMessage = Delegate.create( this, svr2flaLobbyMessage ); // _uri = "rtmp://localhost/fitcDemo"; trace("Now connecting: " + _uri); nc.connect(_uri, _my_member_id, "1", "!eventPassword!"); // member_id, event_id, eventpass } // All messages from server (e.g. announcements and user's chatmessages) public function svr2flaLobbyMessage(evtObj:Object):Void { // _global.Xray.xrayLogger.debug("svr2flaLobbyMessage", evtObj); lobby_output_txt.text = lobby_output_txt.text + "<b>" + evtObj['roomUser'] + "</b>: " + evtObj['textline'] + "\n"; } } > -----Oorspronkelijk bericht----- > Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens > Pham Ngoc Hai > Verzonden: vrijdag 13 juli 2007 16:50 > Aan: [email protected] > Onderwerp: Re: [Red5] Send an event to flash client > > Hi, Ruben Waitz > > What do you have in your svr2flaLobbyMessage? > > In flash I have a simple function: > > function myABC() { > myTextbox.text = "OK" > } > > I call that flash function from my Red5 app: > > service.invoke("myABC", new Object[] {null}); > > but myABC is never called. > > > > > --- Ruben Waitz <[EMAIL PROTECTED]> wrote: > > > Hi Pham Ngoc Hai, > > > > Yes. > > Instead of shared objects I fire events from Red5 to the > > flash client. > > > > This is a little code snippet to invoke the method > > "svr2flaLobbyMessage" on > > all connected flash clients. You can add some > > if-then-else logic to invoke > > on a single client. > > > > IConnection conn = Red5.getConnectionLocal(); > > > > // Walk through all connections and 'message' them all > > Iterator<IConnection> it = > > conn.getScope().getConnections(); > > while (it.hasNext()) { > > IConnection conn2 = it.next(); > > if (conn2 instanceof IServiceCapableConnection) { > > IServiceCapableConnection service = > > (IServiceCapableConnection) conn2; > > service.invoke("svr2flaLobbyMessage", new Object[] { > > oReturn }); > > } > > } > > > > gr, > > Ruben > > > > > > > > > > > > ------------------------------------ > > www.red5tutorials.net: Tutorials - How tos - FAQ > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Namens > > > Pham Ngoc Hai > > > Verzonden: vrijdag 13 juli 2007 13:39 > > > Aan: [email protected] > > > Onderwerp: Re: [Red5] Send an event to flash client > > > > > > Thank you Rob, > > > Is there a way to notify only one client? > > > > > > > > > > > > > > > --- Rob Schoenaker <[EMAIL PROTECTED]> > > wrote: > > > > > > > Use a shared object maybe? You can update values in > > SOs > > > > from the Red5 > > > > side which will be propagated to every client. > > > > > > > > /Rob > > > > > > > > _______________________________________________ > > > > Red5 mailing list > > > > [email protected] > > > > http://osflash.org/mailman/listinfo/red5_osflash.org > > > > > > > > > > > > > > > > > > > > > > __________________________________________________________________________ > > > __________ > > > Get the free Yahoo! toolbar and rest assured with the > > added security of > > > spyware protection. > > > > > > http://new.toolbar.yahoo.com/toolbar/features/norton/index.php > > > > > > _______________________________________________ > > > Red5 mailing list > > > [email protected] > > > http://osflash.org/mailman/listinfo/red5_osflash.org > > > > > > _______________________________________________ > > Red5 mailing list > > [email protected] > > http://osflash.org/mailman/listinfo/red5_osflash.org > > > > > > > __________________________________________________________________________ > __________ > Looking for a deal? Find great prices on flights and hotels with Yahoo! > FareChase. > http://farechase.yahoo.com/ > > _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
