Get button's instance path in button's on(press)

Get button's instance path in button's on(press)

Post by miaoliuju » Tue, 27 Sep 2005 13:56:59


Here has a button, not a button component,

and it has a code in it:
on(press){
trace(this);
}

when I click the button, it trace the instance path of the button's parent
instead of the button's.

How can I get the instance of the button?

Yes, I konw that using XXX_btn.onPress can get, but I just want to konw how
can I do with on(press)
 
 
 

Get button's instance path in button's on(press)

Post by Jecky » Tue, 27 Sep 2005 14:06:25

> Here has a button, not a button component,

That is correct .. on() events apply to the parent of the button .. so the
'this' is the parent, and not the button


use

button.onPress = function () {...}

then the function is a property of the button, and the 'this' will refer to
the button

Its just one of those inconsistencies in Flash.

 
 
 

Get button's instance path in button's on(press)

Post by miaoliuju » Tue, 27 Sep 2005 14:26:20

Thanks Jeckyl .

Anyone else can give me a help?
 
 
 

Get button's instance path in button's on(press)

Post by Jecky » Tue, 27 Sep 2005 14:42:02

> Anyone else can give me a help?

What other help do you need?

Jeckyl