PDA

View Full Version : Trying my 1st if statement. Need some help


Nickbee
03-22-2010, 05:59 AM
Iím working on a complex (for my knowledge) nav bar.

The bar has a sub menu that tweens out when portfolio is clicked. What I want to do is detect if the sub menu is showing and if it is to gotoAndPlay a hiding sequence.

At the top of my page, Outside of any functions I declare the variable and set itís initial value:

var portNav:Boolean = false;


Within my function for my home button click I have this:

if (portNav == True){
MovieClip(parent).gotoAndPlay("hideNav")
}
}

When I publish I get:

Souce:if (portNav == True){
Desc: 1120: Access of undefined property True.

Iím not sure if my issue is syntax or how Iím using the variable.

Some help would be great!

Thanks!

sparX
03-22-2010, 06:50 AM
correct syntax is 'true' with small 't',try this instead, if (portNav), or, if (portNav == true).

Dont know what tween engine your using,but u might want to listen for tween finished event instead such as 'MOTION_FINISH' for flash tweens or 'COMPLETE'(i think it is) for greensock tweens,etc,etc...

Nickbee
03-22-2010, 03:12 PM
correct syntax is 'true' with small 't',try this instead, if (portNav), or, if (portNav == true).

Dont know what tween engine your using,but u might want to listen for tween finished event instead such as 'MOTION_FINISH' for flash tweens or 'COMPLETE'(i think it is) for greensock tweens,etc,etc...


Thanks! It works now! I was wondering why my True was not turning blue. The funny thing is I typed a bunch of correct true and false parameters all day for visibility. I guess that's what happens when you stay up too late and code...