Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button Visable on condition

Status
Not open for further replies.

simonWMC

Programmer
Dec 2, 2002
180
GB
Hello all, hope everyone is well.

I am trying to set the visability of a button to false unless certain conditions are met.

I have put the button inside a movie clip and used an onClipEvent

onClipEvent (load) {
if (partA1 == true && _partB1 == true) {
abn._visible = true ;
} else {
abn._visible = false ;
}
}

Not only does this not work but also the gotoAndplay doesn't work on the button !

If it wasn't for such lovely weather today i would have screamed by now

thanx in advance
 
If the gotoAndPlay isn't working either this is probably a paths problem. Are you directly targeting the button or the clip that it's in? If the button's in the clip that you have the clip event attached to then you should be able to set its visibility using 'this':

onClipEvent (load) {
if (partA1 == true && partB1 == true) {
this._visible = true ;
} else {
this._visible = false ;
}
}


 
Thanx Wangbar

I have now tried using' this' - it has made it disappear but it doesn't reappear even when the variables are true. I used trace, and the variables are definatly true ??????

Now i am confused !
 
Thanx Wangbar, but i managed to crack it.

The problem was being caused by the onClipEvent (load) - i canged it to a OnClipEvent (enterFrame) - and now it works !

When it was loaded the variables were false, they became true after the page had loaded, so the enter frame command was needed.

Cheers !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top