0

有没有办法用 as3 预加载和播放 flash 中的 mp4 视频文件?

我尝试了以下方法,但没有任何运气:

var myMovie:Sprite;


    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop, false, 0, true);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done, false, 0, true);
    l.load(new URLRequest("video.mp4"));

    function loop(e:ProgressEvent):void
    {
      var perc:Number = e.bytesLoaded / e.bytesTotal;
      percent.text = Math.ceil(perc*100).toString();
    }

    function done(e:Event):void
    {
      removeChild(percent); // was removeChildAt(0) but it make more sense this way
      percent = null;

      myMovie = Sprite(l.content);

      addChild(myMovie);

      l.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loop);
      l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);
      l = null;
    }
4

0 回答 0