Monday, March 17, 2008

ActionScript and Flash Media Server 3.

Not hard to do at all. If you have an FMS3 account, toss a video object on the stage and give it the instance name of myVideo. Place the video in the vod folder and use this code:

var nc:NetConnection = new NetConnection(); nc.connect("rtmpe://localhost/vod"); var ns:NetStream = new NetStream(nc); nc.onStatus = function(ncObj:Object) { trace(ncObj.code); if (ncObj.code == "NetConnection.Connect.Success") { ns.setBufferTime(2); myVideo.attachVideo(ns); ns.play("mp4:Vultures"); } };

Just be sure to replace localhost with your RTMP address. If you are streamin out an FLV the play method would be:

ns.play("Vultures");