PDA

View Full Version : Controlling movie with else/if?


zebbah
10-03-2002, 11:12 PM
hello! :)

i'm trying to make my movie perform certain actions depending on what frame a current mc is on, after a button is clicked.

i've tried playing around with else/if, but i can't say i know what i'm doing and i can't get it to work!

isn't it possible to do something like this?:

on (release) {
if (_root.movieClip = 10) {
gotoAndPlay(2);
} else {
_root.stop();
}
}


10 = frame 10 in movieClip
_root.stop() = do nothing

how do i do this??

thnx for any help! :)

Billy T
10-04-2002, 01:36 AM
try

on (release) {
if (_root.movieClip._currentframe == 10) {
gotoAndPlay(2);
} else {
_root.stop();
}
}

zebbah
10-05-2002, 05:03 PM
thnx a lot, Billy T! :)

is this a good way to control a movie?

f.ex. loading a movie based on what frame a specific mc with a button is on.

if (_root.button1._currentframe == 10) {
loadMovieNum("movie1.swf", 1);
} else {
if (_root.button2._currentframe == 10) {
loadMovieNum("movie2.swf", 1);
}
}

or are there other (better) ways to do this?

(one last thing: is it possible to have as many "else" as needed? could i just continue this to "button10" f ex?)

Billy T
10-06-2002, 01:28 AM
yep you can have as many if statements as you want

I'm afraid I don't really understand what you are wanting to do with that script.

what might be a better way is to put the loadMovie code on 10th frame of the button1 mc

cheers

zebbah
10-06-2002, 01:25 PM
hehehe... sorry. it's allways hard for me to explain what i'm trying to do with flash, since i'm not allways sure what i'm doing. :)

i have a menu with five mcs containing a invisible button and some animations for the rollon, rollout and onrelease actions.

some animation is on the _root timeline for the "transition" between different sections, which you get to by clicking the buttons.

i'd like to have the if/else actions in the last frame of the transition animation that can load the different sections depending on which button was clicked.

also if a button is clicked it becomes inactive. maybe it's possible to have an if/else action to check all the buttons and make the inactive one active again when another button is clicked?

does this make any sense?
maybe this is a very complicated way of doing things...?

Billy T
10-06-2002, 10:07 PM
oh I see what you want

just set a variable with your buttons

eg

_root.nextMovie="content45.swf";

and then at the end of the animation have

loadMovieNum(_root.nextMovie,5);

OK?

are you using 5 or MX? If MX, have a look at this - http://www.tableau.com.au/tutorials/coverPreloader/index.html

see the attached file for the button pressed thing

cheers

zebbah
10-21-2002, 09:53 PM
ahhhh! nice! this was exactly what I was looking for! :D

thnx for all your help, Billy T!!

:)

Billy T
10-21-2002, 10:36 PM
no worries

also, I made a tute which might help - http://www.tableau.com.au/tutorials/smooth_transitions/

cheers