Posted By

adrianparr on 04/15/10


Tagged

flv video external load sound play loading as3 netconnection netstream attachnetstream onmetadata


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

socialflasher
donaldleegraham
tspitzr


AS3 Loading and Playing an External FLV File


 / Published in: ActionScript 3
 

URL: http://macromediastudiomx.de/devnet/flash/quickstart/metadata_cue_points.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. }

Report this snippet  

You need to login to post a comment.