PDA

View Full Version : [AS2, MX] :Button script for menu:



abraxas
February 20th, 2005, 01:42 PM
Hello, i need some help with this AS on my button.

on(release){
//MONEY//
if (buildings_on = true or crew_on = true or family_on = true){
buildings_on = false;
crew_on = false;
family_on = false;
money_on = true;
buildings._y = buildings_standard;
crew._y = crew_standard;
family._y = family_standard;
buildings._y = buildings._y - 200;
crew._y = crew._y - 200;
family._y = family._y - 200;
} else {
money_on = true;
buildings._y = buildings._y - 200;
crew._y = crew._y - 200;
family._y = family._y - 200;
}
}


I get this error, and i wonder whats the problem?

**Error** Symbol=meny, layer=Layer 2, frame=1:Line 3: Left side of assignment operator must be variable or property.
if (money_on = true or crew_on = true or family_on = true){

and i wonder how i correct the error. I have in the first frame this;

var buildings_standard = 53.7;
var crew_standard = 75.7;
var family_standard = 97.7;
var money_on = false;
var buildings_on = false;
var crew_on = false;
var family_on = false;


Please help me! :)

senocular
February 20th, 2005, 01:45 PM
= assigns, you want == which compares
also, try to get into the habit of using || in place of "or"

abraxas
February 20th, 2005, 02:09 PM
ok thanks, that worked, and i will start use || instead of or :)

but, i think there is something wrong with the script.. it doesnt work as i want.
I want so when money is released, buildings-crew-family will go down 50 _y. I got that working, but the problem is.
When i press buildings, and they are +50 _y from the money, they will go back to standard _y. They doesnt do that :(
This is the part of the script that would do that;

buildings._y = buildings_standard;
crew._y = crew_standard;
family._y = family_standard;
crew._y = crew._y + 75;
family._y = family._y + 75;

Here, they are suppose to go back to standard _y position, then go -200 _y
but they only go down, not back to standard :(
Can you find the problem?