Groups | Blog | Home
all groups > flash actionscript > september 2004 >

flash actionscript : Button Component


angela_mcdonnell
9/2/2004 7:11:41 PM
I am creating an app and need to know why the following block of code works on
a button component but not on a button that I create myself ?

on(release){
this._parent._visible=false;
this._parent._parent.form1._visible=true;

}

Any help will be appreciated !
derobinson
9/2/2004 8:14:54 PM
You've got too many variable scopes in there. You can use either "this" or
"_parent" (depending on th ecircumstances and what you're trying to accomplish,
but you shouldn't use them both together, nor more than any one of them....it
simply doesn't make structural sense.

If your goal is to make the button itself disappear and a form (called form1)
in the same level as the button (to which this code is attached) appear, try
this:

on(release){
this._visible=false;
_parent.form1._visible=true;

}

Hope that helps!
/david

rlc5611
9/3/2004 6:46:13 AM
If you use "this" on a button button, "this" refers to the timeline the button
is in rather than the button itself. If the button is a movie clip button then,
yes, "this" will refer to the "button". If you want to make a button button
disappear, you cannot use "this".
AddThis Social Bookmark Button