PDA

View Full Version : Variable ending to a scene


Powershifter
05-28-2003, 04:50 PM
I usually design sites with a main movie with navigation buttons in the main movie. To load in new movies I use load targets. This has been working great to date but I would like to add better transitions between clips. Say for example I had a magician on a stage and there where 3 control buttons for different scenes. First thing is him performing the bunny out of a hat trick and now I want to choose another trick I hit the second button and now with "load target" he would vanish and the second MC would load in and he would walk in from stage right to perform a new trick. What I would like is that no matter what button I select I would like him to walk off stage and enter to do the slected trick . I don't know how to get him to end the current scene, once a button has been selected, with the magician exiting stage and then starting the next scene by walking back on stage. Does this make sense??

vosgien
05-28-2003, 05:21 PM
Hi,
This is fairly straightforward to set up using a variable. I will assume that your zanimation of the guy walking of stage ( left) and walking on stage (right) is working OK, I don't know how you are loading in your swf's, I'll assume that you are using an empty mc ( is that right ?)
OK here is what I would do - on your main timeline put

//frame1
stop();
var trick;
containerClip.loadMovie("magicTrick" + trick +".swf");
// frame2
gotoAndplay(1);
//this provides a two fr loop that constantly checks the value
//of trick
/////////////////////////////////////
// then on your button 1 put
on(release){
trick = 1;
animation.play()
gotoAndPlay(2);
}
//same for button 2 & 3, just make trick = 2 ( for button 2) and
//so on

If you rename your swfs magicTrick1 and magicTrick2 and magicTrick3, your container clip will always load in the right swf
The only problemo I can see with that code is the button action sending te playhead to frame2, if your animation is slow, the magicTrick.swf will load before the guy comes back on - let me know if it works

Vosgien

RVK
05-28-2003, 05:37 PM
Vosgien's method described above is a very sound solution. I would just like to expand a little bit. The approach I would use:

I would have each of the 3 swfs have contain the animation of the magician walking on and off the stage.

These numbers are entirely for example:

Frame 01 through 25 - Magician walking on stage.
Frame 26 through 50 - Magician performing trick.
Frame 51 through 75 - Magician walking off stage.

On frame 50 of each swf, I would put in an action frame:
stop();

On frame 75 of each swf, I would put in an action frame:

loadMovie("magicTrick" + _level0.trick +".swf", 1);

Now for my button I would simply use this :


on(release){
trick = 1;
_level1.play();
}

on(release){
trick = 2;
_level1.play();
}

on(release){
trick = 3;
_level1.play();
}


This is also assuming you enjoy dealing with levels. You could also quite easily apply this to a target based assembly.

Good Luck!

-R

Powershifter
06-09-2003, 04:01 PM
Thank You for the ideas.