Discover & Rate New Music Check out ChartVote. Promote the music you like.

Short Video: Commute

I made a video of my commute from work back home.


Commute from Noah Everett on Vimeo.

Flash Video Player in ActionScript 3

You can find a flash video player on almost any website these days, the market is white hot for it. The past few months I have been porting my knowledge from Actionscript 2 to 3.

There are 2 ways to play an FLV file in flash either with a FLVPlayback component or VIA a Video object streamed and controlled with NetConnect and NetStream. I prefer the later because I like to have more "control" over things, but this is a personal preference.

CODE

ACTIONSCRIPT:
  1. var nc:NetConnection = new NetConnection();
  2.  
  3. nc.connect(null);
  4.  
  5. var ns:NetStream = new NetStream(nc);
  6.  
  7. var vid:Video = new Video(320, 240);
  8. this.addChild(vid);
  9.  
  10. vid.attachNetStream(ns);
  11.  
  12. ns.play("http://www.mydomain.com/mymovie.flv");
  13.  
  14. ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);
  15.  
  16. function netstat(stats:NetStatusEvent) {
  17.       trace(stats.info.code);
  18. }
  19.  
  20.  
  21. var netClient:Object = new Object();
  22. netClient.onMetaData = function(meta:Object) {
  23.  
  24.     trace(meta.duration);
  25.  
  26. };
  27.  
  28. ns.client = netClient;

RSS Feed



Recommended Sites