最基本的flv播放器


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var nc:NetConnection = new NetConnection();
  2. nc.connect(null);
  3.  
  4. var ns:NetStream = new NetStream(nc);
  5.  
  6. var vid:Video = new Video(320, 240);
  7. this.addChild(vid);
  8.  
  9. vid.attachNetStream(ns);
  10.  
  11. ns.play("http://www.linkmobile.net/yf/Wanted_T4.flv");
  12.  
  13. ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);
  14.  
  15. function netstat(stats:NetStatusEvent)
  16. {
  17. //trace(stats.info.code);
  18. }
  19.  
  20. var netClient:Object = new Object();
  21. netClient.onMetaData = function(meta:Object)
  22. {
  23. trace(meta.width);
  24. };
  25.  
  26. ns.client = netClient;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.