AS3 Loading and Playing an External FLV File


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



Copy this code and paste it in your HTML
  1. var vid:Video;
  2. var nc:NetConnection = new NetConnection();
  3. nc.connect(null);
  4. var ns:NetStream = new NetStream(nc);
  5. ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
  6. var customClient:Object = new Object();
  7. customClient.onMetaData = metaDataHandler;
  8. ns.client = customClient;
  9. ns.play("video.flv");
  10.  
  11. vid = new Video();
  12. vid.attachNetStream(ns);
  13. addChild(vid);
  14.  
  15. function asyncErrorHandler(event:AsyncErrorEvent):void
  16. {
  17. trace(event.text);
  18. }
  19.  
  20. function metaDataHandler(infoObject:Object):void {
  21. vid.width = infoObject.width;
  22. vid.height = infoObject.height;
  23. }

URL: http://macromediastudiomx.de/devnet/flash/quickstart/metadata_cue_points.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.