PDA

View Full Version : Keeping track of things


Griffe
02-17-2004, 03:23 PM
I have this small problem... I'm a complete noob to actionscript, still I wanna figure something out.

I have this scene which works great. It gives questions in random order, exactly what I need. But now the problem occurs, it goes on endlessly. Now I made a variable in the first frame... (I think I did this wrong) In my opion it needs to have value "0". Then for every question that's answered right it needs to add "1" to the variable and then it needs to check, when the variable is equal to 5, it needs to goto and play to a new scene.

How do I program this variable thingamading ??

Regards,
da Griffe

AngelEyesShadow
02-17-2004, 08:32 PM
I'm confused. First try to give us a clear idea on what u wanna do, and we'll help u ... :D

Griffe
02-18-2004, 02:34 AM
Basically I wanna make this: a quiz

There's 15 questions. When you answer wrong you'll have to start over, (they come in random order, so you won't get the same kind of questions the whole time) when you answer right you go to the next question untill you did 5. Once you did 5 you 'will win'

divarch
02-18-2004, 04:29 AM
Is it made through scenes, or keyframes in a single scene?
How did you make the variable tracking? Give some sample code.

And, if you're not to far with your movie, I suggest to dump the scenes, and do it through frames and labels, much better.

GothicMink
02-18-2004, 04:38 AM
Hi!

Funny, i did the same thing once!
Anyway. What do you use to allow users answering the questions? Radio buttons? just buttons?

In any case, you have your variable on the first frame on the root right? Just create/initialise it by writing:
_root.TheVariable = 0;
or
TheVariable = 0; (only if your doing this on the root of the movie)

In both cases, that means your variable belongs to the root.
From nowon, you can access this variable from anywhere in your movie by refeering to it as:
_root.MyVariable

So when a user answers a question, whether you increase this _root.MyVariable if the answer is right, or you don't do anything if the answer is wrong.

Hope this was your problem.

Note: you can also use a global variable.....But i never do.....