PDA

View Full Version : var.... and if..



thediablo
June 20th, 2003, 01:17 PM
ok...
i got a button with this AS


on (release) {
evento = "si";
gotoAndPlay(777);
}


now...

that works...

but when i reach.. frame 1428 i got another AS


if (evento = "si") {
gotoAndPlay(5794);
}



which is not working...

i think my problem is the IF :P

help...

thanks!

Voetsjoeba
June 20th, 2003, 01:19 PM
They don't use the same evento. They declare their own. Replace both by _root.evento and it should work.

And you have an error in your syntax. Should be if (_root.evento == "si"){something}

thediablo
June 20th, 2003, 01:22 PM
nop....



if (_root.evento = "si") {
gotoAndPlay(5794);
}


not working...

:(

Voetsjoeba
June 20th, 2003, 01:23 PM
See my edit :)

thediablo
June 20th, 2003, 01:25 PM
thats it..

lil explain about the dif of = and == and ===

thanks :D

Voetsjoeba
June 20th, 2003, 01:27 PM
= stores a value in a var, == checks for equality (is that a correct word ? :P ) and === checks for strict equality ( the vars must match type )

thediablo
June 20th, 2003, 01:27 PM
also if the condition evento == "si" is false... it just goes to the next frame right?

Voetsjoeba
June 20th, 2003, 01:29 PM
Yep. If you don't want it to continue if false you can use


if (_root.evento == "si"){
gotoAndPlay(5794);
} else {
anthing you want here.
}

thediablo
June 20th, 2003, 01:33 PM
ok...

thankssss

Voetsjoeba
June 20th, 2003, 01:33 PM
np :)