Skip to main content
Participant
April 25, 2006
Question

How do I define a boolean?

  • April 25, 2006
  • 3 replies
  • 639 views
I feel stupid about asking this, but I've never really had a need to use much actionscript....

regardless, I'm needing do have a bool that will get check by buttons, so how do I declare/define it? I work in game code, all I do is bool blablabla; and thats it. I've been looking at dictionary in flash, but it isn't much helps.

is it: Boolean( myBool ); or what?

and do I check a boolean the same as I would in c++, e.g. myBool == 1?

Thanks.

This topic has been closed for replies.

3 replies

kglad
Community Expert
Community Expert
April 26, 2006
yes but, as always, you'll need to use the correct path to your variable.
bxSiNAuthor
Participant
April 29, 2006
ok, more questions in relation to bools.

This is what I have.

Main timeline in frame1, created my bools and set them all to false. I have 4 buttons on the main timeline as well. If each button I have code that needs to check if the bools are true, do something else, and then set the one of the bools to true so the other buttons will know they're used. Here is the code, it might make sense:

quote:

on(press){
if( nav2Loaded ){
_root.navmc2.gotoAndPlay( [unload], 1 );
}
if( nav3Loaded ){
_root.navmc3.gotoAndPlay( [unload], 1 );
}
if( _root.nav4Loaded ){
_root.navmc4.gotoAndPlay( [unload], 1 );
}
}
on(release){
if( !nav1Loaded ){
loadMovie( "nav1.swf", navmc1 );
}
_root.nav1Loaded = true;
}


is this right? or do I have to specify the frame the original bool is in?
Inspiring
April 25, 2006
var bVar:Boolean = true; // or false
...

if (bVar) {
// what to do if it's true
} else {
// what to do if it's false
}


if you want to test if its values is false: if (!bVar)



bxSiN wrote:
> I feel stupid about asking this, but I've never really had a need to use much
> actionscript....
>
> regardless, I'm needing do have a bool that will get check by buttons, so how
> do I declare/define it? I work in game code, all I do is bool blablabla; and
> thats it. I've been looking at dictionary in flash, but it isn't much helps.
>
> is it: Boolean( myBool ); or what?
>
> and do I check a boolean the same as I would in c++, e.g. myBool == 1?
>
> Thanks.
bxSiNAuthor
Participant
April 26, 2006
thanks.

so I could put that in say the first frame on the main timeline and be able to query to bool from a button or inside a movie clip?
kglad
Community Expert
Community Expert
April 25, 2006
you can use the following: