Reactor Chat Tutorial, Part 1
Waiting for the Connection to be Ready
When the connection is established and ready for use, Reactor dispatches a ReactorEvent.READY event. Applications must wait for that event before starting, like this:
package { import flash.display.Sprite; import net.user1.reactor.Reactor; // Import the ReactorEvent class import net.user1.reactor.ReactorEvent; public class UnionChatPart1 { protected var reactor:Reactor; public function UnionChatPart1 () { reactor = new Reactor(); // Triggers readyListener() when the connection is ready reactor.addEventListener(ReactorEvent.READY, readyListener); reactor.connect("tryunion.com", 80); } // Method invoked when the connection is ready protected function readyListener (e:ReactorEvent):void { } } }