TheAMM

Untitled

Mar 29th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import flash.utils.ByteArray;
  2. import flash.media.Video;
  3. import flash.net.NetConnection;
  4. import flash.net.NetStream;
  5. import flash.events.NetStatusEvent;
  6.  
  7. var et:ET = new ET(stage, "MoreThanABird");
  8.  
  9. [Embed(source="morethan.flv", mimeType="application/octet-stream")]
  10. var cls : Class
  11. var vbytes : ByteArray = new cls() as ByteArray;
  12.  
  13. var video : Video = new Video(480, 360);
  14. video.smoothing = true;
  15. addChild(video);
  16.  
  17. var nc : NetConnection = new NetConnection();
  18. nc.connect(null);
  19. var ns :NetStream;
  20.  
  21. playVideo();
  22.  
  23. function playVideo() {
  24. ns = new NetStream(nc);
  25. ns.client = {};
  26. ns.addEventListener(NetStatusEvent.NET_STATUS, nsNetStatus);
  27.  
  28. video.attachNetStream(ns);
  29. ns.play(null);
  30. ns.appendBytes(vbytes);
  31. }
  32.  
  33. function nsNetStatus(e:NetStatusEvent) {
  34. var code:String = e.info.code;
  35. if (code == "NetStream.Buffer.Empty") {
  36. ns.removeEventListener(NetStatusEvent.NET_STATUS, nsNetStatus);
  37. playVideo();
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment