Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I define a boolean?

New Here ,
Apr 24, 2006 Apr 24, 2006
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.

TOPICS
ActionScript
649
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 24, 2006 Apr 24, 2006
you can use the following:
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 25, 2006 Apr 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 25, 2006 Apr 25, 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 25, 2006 Apr 25, 2006
yes but, as always, you'll need to use the correct path to your variable.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 28, 2006 Apr 28, 2006
LATEST
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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines