1
votes

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);
  gotoAndPlay ("3");
}

any help would be appreciated.

thanks

2

2 Answers

1
votes

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.

0
votes

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);
    }
}