views:

80

answers:

1

I would like to hide a button.

I'd like to pass a variable thru the url like so:

//test.swf?control=0;

control 1: being on, 0: off


if(_root.control =='1')
{
    button._visible = true;
}

Can anyone explain why the button is visible when "test.swf?control=0;" is passed thru the url.

+1  A: 

I'm taking a stab in the dark here, but I think the button is visible by default. You're probably never handling the other case; in other words, you're missing an 'else' block:

if(_root.control =='1')
{
    button._visible = true;
}
else
{
    button._visible = false;
}

which could also be written as

button._visible = (_root.control == '1')

In fact, the second format is generally preferred because it's a bit shorter with no expense of readability.

Mark Rushakoff
Thanks Mark. There's some smart fellas here on this site. Appreciate it.
rrrfusco
You're welcome -- accepting this answer just bumped me up to 10k, so thank *you* very much :)
Mark Rushakoff

related questions