PDA

View Full Version : forgetting variables!!???


Vollevuist
04-02-2003, 05:44 PM
hi there

i am building a flash-site, and got stuck with the following problem:

i made a button, and if you click on it the following actions are taken:

on (press)
set variable: "/movie1:number"="2"
begin tell target("/movie1")
play
end tell target
end on

well, when movie1 starts playing, it plays until frame 12. in frame 12 there is a stop action, and also a frame with the following actions:

if (number=2)
begin tell target("r-preview")
play
end tell target
end if

so after you click the button, movie 1 is supposed to start playing and in frame 12 another movie should start. i don't think there is an easier way to do this, because there are different buttons and another movie is supposed to start in movie 1, depending on which button you clicked.

but now the problem:
movie 1 stops playing in frame 12, but the r-preview movie doesn't start! i'm positive i got all instance names and paths correct and everything. the r-preview movie does start when i click the button again when movie1 is already in frame 12, so i have to click the button twice, with about a second interval. it seems like the variable "number" isn't really stored. so when the flash player checks the variable he only finds it when i am clicking the button at the same time.

does anyone have experience with my problem? does anyone know how to solve it? i am not an expert with actionscript, so i just can't figure what i did wrong.

thank you

subquark
04-02-2003, 05:55 PM
does this have to be done in Flash 5? I know how to write this in MX but that won't help you if you're publishing in 5.

moock has similar coding for a quiz that is both in MX and 5

moock (http://moock.org/asdg/codedepot/)

Vollevuist
04-02-2003, 07:13 PM
i don't use mx or flash 5, but i do use flash 4. i know it's old, but i've seen mx and i don't like the interface. and except for the interface, the difference between flash 4 and mx isn't that big.

so, do you know how to solve my problem in flash 4? and which one of moock's quizzes is the one that uses the same system i am trying to use? there are quite a lot of quizzes on his site.

thanks

tg
04-02-2003, 07:37 PM
since i know squat about f4, this is just a guess...

you set your variable to "2"
but you check to see if it is 2

the first is a string.
the second is a number.
try changing your if statement to:
if(number="2")...

or set the whole path:
if(/movie1:number="2")


maybe one of those will help.

subquark
04-02-2003, 09:35 PM
flash 4, sorry, those ":" are weird, good luck!

Vollevuist
04-02-2003, 09:37 PM
no, doesn't work

in the set variable string, i can't remove the quotes, and if i add them in the if string, the same thing happens.
however, i do think the variable is stored right, but something else goes wrong. because if i click the button while the movie is already in frame 12, the r-preview does start playing, and the button only makes the movie play (it stops in 12, in 13 is a goto and stop 12 action) and it sets the variable. so if that variable doesn't work in some way, the r-preview wouldn't start playing. i just don't get why it doesn't start when the movie arrives at frame 12, but only when it's in 12 and i click the button again...