Streaming FLV files in Flash MX 2004
June 19, 2006 | 0 comments
“Streaming” FLV files in Flash MX 2004
If you haven’t yet used NetConnection and NetStream right in Flash MX 2004, why don’t you give it a try. Now you can dynamically load FLV files right in Flash without the FlashCom server.
- var connection_nc:NetConnection;
- var stream_ns:NetStream;
- var clickListener:Object = new Object();
- clickListener.click = function() {
- connection_nc = new NetConnection();
- connection_nc.connect(null);
- stream_ns = new NetStream(connection_nc);
- stream_ns.setBufferTime(5);
- movie_video.attachVideo(stream_ns);
- stream_ns.play(“video1.flv”);
- };
- play_btn.addEventListener(“click”, clickListener);
Note that if you strict type inside the function, this code will not work. So, if you don’t use a function, this code works just fine.
- var connection_nc:NetConnection = new NetConnection();
- connection_nc.connect(null);
- var stream_ns:NetStream = new NetStream(connection_nc);
- stream_ns.setBufferTime(5);
- movie_video.attachVideo(stream_ns);
- stream_ns.play(“video1.flv”);
Comments