Tracing instnce name of Button

I need a Button which trace its instance name
i can make it by a movie clip and Button.
but i want make it by a Button only.

On (press) {
trace this.name
}

thank you for your help

Well, you can use a movie clip with an on (press) handler :

 on (press) {
&nbsp &nbsp &nbsp &nbsp trace (_name) ; // works fine here
&nbsp &nbsp &nbsp &nbsp this.enabled = false ; // disables the button. Just for fun
}

I wrote something about button/clips, and Kirupa should put it online within 2 months :smiley:

pom 0]

thank you for you help :slight_smile:
Saadat from Iran

Or even better, because it works with a button :smiley: :

  myButton.onPress=function () {
  trace (this._name);
}

You have to put that in the first frame of your animation.

The trouble was : with on (press) {} handlers, you use the Flash 5 method that made buttons point to the timeline containing them. Here, even though you put this. in front, it’s still the case (for a matter of compatibility) so in fact you were asking flash to trace the name of the _root.

pom 0]