TranceAddict Forums

TranceAddict Forums (www.tranceaddict.com/forums)
- Chill Out Room
-- Flash MX if statement syntax


Posted by Turbonium on Aug-28-2004 20:37:

Flash MX if statement syntax

In Java (where bla1 & bla2 are boolean):

if (bla1 == true && bla2 == false) {
}

How would you do that in flash? Most of it is the same I think, I just don't know about the "&&" part.


Posted by igottaknow on Aug-28-2004 21:10:

uses the same syntax as javascript and it should tell you how to contruct an if statement in the Help


Posted by AnotherWay83 on Aug-29-2004 00:40:

Re: Flash MX if statement syntax

quote:
Originally posted by Turbonium
In Java (where bla1 & bla2 are boolean):

if (bla1 == true && bla2 == false) {
}

How would you do that in flash? Most of it is the same I think, I just don't know about the "&&" part.


i dont know abt flash MX but the last time i coded with actionscript was with flash 5, and if they havent changed the precedence rules then you will have to enforce it with parentheses, like so:

if ((bla1 == true) && (bla2 == false)) {
}

btw, your java code isn't optimal...if bla1 and bla2 are boolean, you might just as well drop the == part to get:

if (bla1 && bla2) {
}

i dunno if actionscript has a boolean data type or not


Posted by igottaknow on Aug-29-2004 04:04:

Re: Re: Flash MX if statement syntax

quote:
Originally posted by AnotherWay83
i dont know abt flash MX but the last time i coded with actionscript was with flash 5, and if they havent changed the precedence rules then you will have to enforce it with parentheses, like so:

if ((bla1 == true) && (bla2 == false)) {
}

btw, your java code isn't optimal...if bla1 and bla2 are boolean, you might just as well drop the == part to get:

if (bla1 && bla2) {
}

i dunno if actionscript has a boolean data type or not

I haven't coded java in a couple of years but, i think ur mistaken, the correct syntax should have a not operator to flip bla2 to true

code:
if (bla1 && ! bla2){ }


Posted by AnotherWay83 on Aug-29-2004 04:29:

Re: Re: Re: Flash MX if statement syntax

quote:
Originally posted by igottaknow
I haven't coded java in a couple of years but, i think ur mistaken, the correct syntax should have a not operator to flip bla2 to true
code:
if (bla1 && ! bla2){ }


oh yeah, you're right - i forgot that he wanted bla2 to be false...the code i showed is right if you want both bla1 and bla2 to be true...



Powered by: vBulletin
Copyright © 2000-2021, Jelsoft Enterprises Ltd.