PDA

View Full Version : movieclip sequence


it_babe
07-09-2004, 07:38 PM
I have an instance of a movieclip on my main swf which is trigged by a button. After this movieclip has finished, I want to load an external swf into the main swf. What is the right actionscript for this?

Here is what I want:

on(release){
my_mc_instance.gotoAndPlay(1);

when my_mc_instance has finished {
loadMovieNum("mymovie.swf", 1)

}
}

markL
07-09-2004, 07:43 PM
Inside the my_mc_instance's timeline, create a keyframe at the end of it and put the loadMovieNum method there.

Added to your button.

on(release){
my_mc_instance.gotoAndPlay(1);
}

Added at the end of my_mc_instances timeline

loadMovieNum("mymovie.swf",1);

it_babe
07-09-2004, 07:58 PM
thanks for the reply. The problem is that I will be using the movieclip instance several times, but the external swf will be a different one depending on which button is clicked. What do I do then?

markL
07-09-2004, 08:15 PM
Well everyone has their own methods of getting from point A to B. And I'm not fully understanding exactly your situation. Could you please give a little more info?

example: Are the movieClip instances used a buttons or to tell Flash to load a swf?

it_babe
07-09-2004, 08:26 PM
I have several buttons on my main swf, and no matter which button is being clicked, the same movieclip instance will be played. The movieclip instance is just a simple animation.
BUT: The difference between the buttons is that after the movieclip instance is done playing, they will each trigger a different external swf. Let's say there is a button for "home" and another one for "news" which will each load a "home.swf" and a "news.swf" when clicked.

markL
07-09-2004, 09:03 PM
Give me a few and I will create a function to handle that.

it_babe
07-09-2004, 09:09 PM
No sure what u mean...
Button #1: Profile
on(release){
this.contentframe.gotoAndPlay(1);
//load profile.swf
}

Button #2: Webdesign
on(release){
this.contentframe.gotoAndPlay(1);
//load webdesign.swf
}

Button #3: Contact
on(release){
this.contentframe.gotoAndPlay(1);
//load contact.swf
}

markL
07-09-2004, 09:15 PM
This probably doesn't work but it at least gives you an idea of maybe how to do this.

var swfArray:Array = new Array("us.swf", "me.swf", "you.swf", "him.swf", "her.swf");
function mcLoader(swfName) {
this.onPress = function() {
this.onEnterFrame = function() {
if (_root.my_mc_instance._currentframe<_root.my_mc_instance._totalframes) {
_root.my_mc_instance.nextFrame();
} else {
_root.loadMovieNum(swfName, 1);
_root.my_mc_instance.gotoAndStop(1);
delete this.onEnterFrame;
}
};
};
}
for (i=0; i<swfArray.length; i++) {
this["btn"+i].mcLoader(swfArray[i]);
}

it_babe
07-09-2004, 09:23 PM
Thanks a lot, but it would be a great help if you could tell me where to put it (after altering it of course) and what it does... I'm just a beginner :o

markL
07-09-2004, 09:29 PM
Well you would just name your buttons btn0, btn1, btn2, btn3, btn4 and put the buttons on the _root timeline and then create an actions layer and place that code in it. Then in the swfArray just assign the slots with the name of the swf's.

ie: being how the for loop i starts at 0 and would call swfArray[0], you would want to use the name of the swf that btn0 would load or reload.

Far as the code I scribbled, I was having trouble with getting the function to work correctly. Maybe someone can explain why it wasn't working?