0

我正在使用与预加载另一个 swf 相同的代码,但这次它不起作用。这一次的问题是,当加载条达到 16% 时,每次你可以听到我正在加载的电影在后台播放。我可以在我正在加载的电影的第一帧(“trial_1.swf”)中添加一个停止,但是我如何告诉它在加载后转到第二帧?

任何帮助深表感谢!

这是我的代码:

var myrequest:URLRequest = new URLRequest("trial_1.swf");
var myloader:Loader = new Loader();

myloader.load(myrequest);
myloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progresshandler);

function progresshandler (myevent:ProgressEvent):void {
    var myprogress:Number = myevent.target.bytesLoaded / myevent.target.bytesTotal;
    bar_mc.scaleX = myprogress * 1.5;
    myTextField_txt.text = Math.round(myprogress * 100) + "%"
}

myloader.contentLoaderInfo.addEventListener(Event.COMPLETE, finished);
function finished (myevent:Event):void {
    addChild(myloader);
    removeChild(myTextField_txt)
    removeChild(bar_mc);
    removeChild(logo_mc);
}
4

1 回答 1

0

Why not put a special starting frame at the beginning of your trial_1.swf (along with the stop(); you've got on that first frame) which has as button staying 'Start Movie'. When the button is clicked, it moves the timeline to frame 2 with gotoAndPlay(2);.

If you do it like that it's up to the user when to start playing the animation, and it can only be done once it's loaded fully, and the swf is on the stage. That should solve your problem.

To be honest though, I'm not sure why your animation is beginning to play before it's fully loaded. That's certainly odd.

于 2010-03-24T04:23:22.630 回答