View Full Version : Frustrated with variables
/Pyro
02-10-2003, 06:05 PM
Ok, I have asked about variables before and you guys have tried to help me. Its probably my fault, not yours. But anyway...I have got it to work for the most part. Now I am having trouble with variables in my If statements.
I'll attatch the fla if anyone wants to look over it. Don't laugh to much.. :)
The main problem is the part where you click the "test me" button. I have an if statement that evaluate the variable moboset. If I change the statement to look for a false variable, it works. This leads me to believe it is a problem with setting my variable. Here is the line that sets the variable moboset:
moboset = true;
I have tried doing that line in normal and expert mode and the same thing happens.
CyanBlue
02-10-2003, 11:58 PM
Hi...
I don't see that line, moboset = true;, in your script... and that's why your if statement works only when the value is false... When are you supposed to set the value to true???
Oh, by the way, on the motherboard, you have a script that says moboset = "Off' or something which is not consistence... Whether change it to true/false or change the variable name...
/Pyro
02-11-2003, 01:31 AM
the motherboard on the right has the moboset = true; line attatched to it. the motherboarddone has moboset = "Off";
I tried changing that to false on clipevent load as to make sure it loaded false to start. the reason for this variable is so that i know when they have placed the motherboard inside the computer. Once I get the motherboard figured out, i am going to place similar scripts on the other objects. Then i can know when they are totaly done and allow them to go to the next scene.
Thanks
CyanBlue
02-11-2003, 03:40 AM
Oh... I see that... and that is the problem you have...
I see...on (release) {
stopDrag ();
if (_x>41 & _x<71 & _y>95 & _y<125) {
setProperty ("", _visible, 0);
// moboset = true;
_level0.moboset = true;and I have added _level0 in front of moboset variable because if you just say moboset = true; it means that you are setting the varible moboset which is located in the same level as the movieclip and there is no variable called moboset in that path... So, you are actually decalring another variable in that path...
By putting _level0 in front of the variable name, you are making sure that you are directing the moboset variable which resides in the main timeline... Know what I mean???
Anyways... I have added _level0 in front and changed your if statement to beon (release) {
if (moboset) {
gotoAndPlay ("Scene 2", 1);
}
}and I see this one working fine...
Besides, you might want to get rid of that setProperty and other old style syntax such as '/' and use dot syntax instead unless you want to export the movie to F4...
Also, avoid using the scene name in the godoAndPlay() function... Use frame label instead... That will save you big time later... and you will be thanking me for that... :D
/Pyro
02-11-2003, 11:36 AM
It works exactly the way I want it now. Thank you SO much! It was the _level0. in front of the variable, or my lack there of. It was a little hard to grasp at first, but it now makes perfect sense. I can't thank you enough. I will post the finished site once I complete the rest of the small stuff. That way you can see how much you have helped me.
CyanBlue
02-11-2003, 07:38 PM
Glad you understand where the problem exists...
If you want to do something for me... Do change those old F4 syntax into the dot syntax... How's that???
Yup... I'd love to see what the final site might be... :)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.