Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 18th, 2012  |  syntax: None  |  size: 0.90 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2.  
  3. var duration;
  4.  
  5. //Instantiate Video Object
  6. var video:Video = new Video(591,290);
  7. video.x = 0
  8. video.y = 0
  9.  
  10.  
  11.  
  12. //Instantiate NectConnection
  13. var nc:NetConnection = new NetConnection();
  14. nc.connect(null);
  15.  
  16.  
  17. //Instantiate Net Stream and link it to Net Connection
  18. var ns:NetStream = new NetStream(nc);
  19.  
  20.  
  21. // Prepare meta Object to receive extra information about NetStream
  22. var meta:Object = new Object();
  23. meta.onMetaData = function(meta:Object){
  24.        
  25.         trace(meta.duration);
  26.         duration = meta.duration;
  27. }
  28.  
  29.  
  30. // Connect Meta to ns
  31. ns.client = meta;
  32.  
  33. // Start playing the video through Net Stream
  34. ns.play('chicago.flv');
  35.  
  36.  
  37. // Plug Net Stream into video Object
  38. video.attachNetStream(ns);
  39.  
  40.  
  41. // Put video object on the stage
  42. stage.addChild(video);
  43.  
  44.  
  45. stage.addEventListener(Event.ENTER_FRAME, function(ev:Event){
  46.         progressBar.bar.scaleX = ns.time/duration;
  47.         trace(ns.time/duration);
  48.  
  49. });