开发者

Flash - how to load movie and start at a particular frame

I'm new to flash and action script 2, and I am trying to load an external movie and have it start at frame 3. It's the start at frame 3 that I'm having trouble with.

The following code does not work:

on release {
  loadMovie ("myMovie.swf",this);
  gotoAndStop (3);
}

or:

on release {
  loadMovie ("myMovie.swf",this);
  gotoAndP开发者_运维技巧lay ("3");
}

any help would be appreciated.

thanks


try

var mycLoader:MovieClipLoader = new MovieClipLoader();

myLoader.addListener(this);
myLoader.loadClip("myExternalMovie.swf", myContainer);
function onLoadInit(mc:MovieClip) { 
     mc.gotoAndPlay(3); 
}

this.gotoAndPlay(3);

Where myContainer is an empty movie clip that you want to swf to load into.


If you need to load your swf file and want it to start from the frame 3 of your main movie, you just have to create an emptyMovieClip named container in your frame 3, and to put the following code into your actionScript panel:

container.loadMovie('myMovie.swf');

If you want the loaded swf to start itself at a particular frame, you can write the following code:

var frame:Number = 4; // selected frame

container.loadMovie('myMovie.swf');
this.onEnterFrame = function() {
    if (container._framesloaded >= frame) {
        container.gotoAndStop(frame);
        delete (this.onEnterFrame);
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜