Variable trouble

I’m trying to make a animation that can be run a couple of ways and I am having trouble with variables. I’m trying to have it so that you cna chose at the begining if it will play with stops in it so that it can explain what is going on or without stops, so you can see what is happening. The revelent code is the step related stuff in the buttons on the start scene and the frames on the actions layer in the photo scene. Thanks,
-Alex K

Since the file is too big it is here:
http://homepage.mac.com/abk/Photosynthesis.fla

Well your setup here is very confusing, I can’t seem to find your content anywhere, except for your layout, preloader, and buttons.

But anywho, The code on your buttons are all wrong…

on (release) {
	gotoAndPlay();
	stop = ney;
	continue = yay;
}

That is what you have on your button.

  1. gotoAndPlay() doesn’t work, you need to tell it what frame to play… like gotoAndPlay(frame#). If you just want it to continue playing your movie, then use play().

  2. stop and continue are predefined functions in Flash. You can’t use them as variables. I suggest maybe using doStop and doContinue or something, as they are not predefined functions in Flash. Also… on the first timeline of your movie you should define these…

_global.doStop = null;
_global.doContinue = null;

What this does is defines a global variable that can be accessed all throughout your movie with targetting it like _root.variable, or _parent.variable or anything like that. I set it to null so it would have no default value.

  1. ney and yay are not variable, but you write them as they are. In this case you will have to make ney and yay strings. This can easily be done by writing “ney” and “yay” (double quotes important).

Now… although I can’t find any content so I don’t know how you if statements look, I am going to explain how it should look.

Commonly people tend to use if(myVariable = something){ //do this }, but that syntax is wrong. To check if a variable is equal to something or not you must do

if (myVariable == something){ //do this }

The == compares the variable and the value to see if it is equal or not.

Ok, so in your case it would go something like this…

if (doStop == "yay"){ stop(); }

You just put that on a frame that is supposed to stop if it is set to stop. What it does is checks if the variable doStop to see if it is equal to “yay” and if it is, it runs the stop action.

I hope this information helps.

Thanks for the help.
Flash was acting up when I saved and posted it on the server, so the file should be there now that is correct. I think I understand where your going, I’m just confused by the fact the file that went up was bad.
Thanks,
-Alex K

Alright, well I pretty much explained how to fix it last time, I will just say what I did real quick now.

I changed the button actions to this…

on (release, keyPress "s") {
	step = "yay";
	carry = "yay";
	gotoAndPlay("Photo", "Start");
}

It is important that the “yay” and "ney"s be in double quotes.

Also…

On frame one of that same scene I added…

_global.step = null;
_global.carry = null;

That creates the global variables that can be used all throughout your movie.

and lastly, the if statments…

if (step == "yay") {
	stop();
}