/**
* Copyright geko ( http://wonderfl.net/user/geko )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zvfV
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
import flash.events.NetStatusEvent;
public class FlashTest extends Sprite {
public var txt:TextField;
public var server:Red5;
public function FlashTest() {
txt = addChild(new TextField()) as TextField;
txt.width = stage.stageWidth;
txt.height = stage.stageHeight;
server = new Red5();
server.connect("rtmp://localhost/test");
server.addEventListener(NetStatusEvent.NET_STATUS, function netStatus(event:NetStatusEvent):void{
trace(event.info.code);
});
}
public function trace(...str):void{
txt.appendText("\n");
txt.appendText(str.toString());
txt.scrollV = txt.maxScrollV;
}
}
}
import flash.events.EventDispatcher;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
class Red5 extends EventDispatcher{
public var nc:NetConnection;
public function Red5():void{
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, function _dispatchEvent(event:NetStatusEvent):void{
dispatchEvent(event);
});
}
public function connect(serverURL:String):void{
nc.connect(serverURL);
}
}