Posted By

brewsie on 06/27/12


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

PawelGIX


ns stream video flash as3


 / Published in: ActionScript 3
 

1k video player load for banners

  1. var nc:NetConnection = new NetConnection();
  2. nc.connect(null);
  3. var ns:NetStream = new NetStream(nc);
  4. ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
  5. ns.play("/*insert video url here*/");
  6. function asyncErrorHandler(event:AsyncErrorEvent):void
  7. {
  8. // ignore error
  9. }
  10.  
  11. var vid:Video = new Video();
  12. vid.attachNetStream(ns);
  13. addChild(vid);
  14.  
  15. ns.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
  16. function statusHandler(event:NetStatusEvent):void
  17. {
  18. switch(event.info.code){
  19. case "NetStream.Play.Start" :
  20. //trace("play");
  21. gotoAndPlay(2);
  22. break;
  23. case "NetStream.Play.Stop" :
  24. //trace ("stop");
  25. gotoAndPlay("endFrame");
  26. break;
  27. default :
  28. break;
  29. }
  30. }

Report this snippet  

You need to login to post a comment.