开发者

Play movieClip before initialize

So I have a custom preloader with 200 frames and the corresponding in Flex:

gotoAndStop(Math.ceil(e.bytesLoaded/e.bytesTota开发者_开发问答l*100));

So basically each procent is one frame in the movieClip. So when 100% the movie ends and application initializes.

How can I say for example so that when 100% don't start the app but play from frame 100-200 in the movieClip and then initialize the app?

Thanks,


How about adding an event listener when loading is complete, then displaying the MovieClip frame one after another from 100-200. When that is done, you can dispatch the complete event.

private var _currentFrame:int;

private function initComplete(e:Event):void
{
    _currentFrame = 100;
    addEventListener( Event.ENTER_FRAME, onEnterFrame );
}

private function onEnterFrame( e:Event ):void {
    if ( _currentFrame < 200 ) {
        _currentFrame++;
        cp.gotoAndStop( _currentFrame );
    } else {
        removeEventListener( Event.ENTER_FRAME, onEnterFrame );
        dispatchEvent(new Event(Event.COMPLETE));
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜