View Full Version : Buttons performing multiple actions
barry_sheen
01-17-2002, 11:39 AM
Hi There,
I have two movieclips, each of which get to the 10th frame and stop. At this frame, they also change the value of the variable 'movie'.
I also have two buttons. On release, they check the value of 'movie' and act accordingly. The only problem is they don't work. The idea is to be able to randomly press either button, and the movieclip that is displayed finishes off and then the next movieclip plays.
I have attached a copy of the .fla file, please could someone take a look and tell me where I'm going wrong.
Thanks A lot
Barry
farafiro
01-17-2002, 12:30 PM
I've got the file
so mess code there barry_sheen
u can do this by a very simple way
pu this codes on the buttons :
on(release) {
_root.mc0._visible=0
_root.mc1._visible=1
_root.mc1.play
}
and via verse on the other button.
also in frame 1 on the root time lise donr forget to set the _visible of the two MC to 0 (false)
barry_sheen
01-17-2002, 12:38 PM
I did look at doing it like you said, but eventually I will add more buttons and movieclips and this will not work with more than two.
Any ideas
Barry
farafiro
01-17-2002, 12:43 PM
it works with whatever numbers u want but will be lots of codes, so u can do it with functions ()
and it's not my playground now
barry_sheen
01-17-2002, 02:21 PM
Ok, thanks for sharing your playground.
Anybody else got any ideas?
I'm desperate!!!!
few things i noticed in your code:
1. if you ar doing a comparison, don't use "=" sign this assign the value on the right side of the operator to the variable on the left side of the operator. use the "equality operator" (==).
2. please don't take this personally, but if you indent your code inside blocks of code, you will see errors much more easily. just to be clear...
on(release){
if(a==b){
do abunchofcodehere
}
}else{
doabunchmorecodehere
}
/*the above code will give a compile error cause a made a few mistakes... if i had indented they would stand out...
on(release){
if(a==b){
do abunchofcodehere
}//this is the first error, the if statement terminates here- this one should be removed.
}else{//compile error will say something like else without if statement
doabunchmorecodehere
}
// a "}" should be here to terminate the on(release) statement
last item i noticed, is that you check to see if movie1 is set with one button and if movie2 is set with the other, but i don't see anywhere the variables get set(maybe i'm missin something here).
anyway, i hope this helps, goodluck
barry_sheen
01-18-2002, 09:20 AM
Sorry about the code, I'm just getting started, and have no programming experience. Thanks for the help.
Barry
no problems, sorry bout the lecture, hows the flash going now?
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.