# Tracing instnce name of Button

**URL:** <https://forum.kirupa.com/t/tracing-instnce-name-of-button/1822>\
**Category:** Uncategorized\
**Created:** [May 17, 2002, 7:03pm UTC](https://forum.kirupa.com/t/tracing-instnce-name-of-button/1822 "2002-05-17T19:03:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 17, 2002, 7:03pm UTC](https://forum.kirupa.com/t/tracing-instnce-name-of-button/1822/1 "2002-05-17T19:03:46Z")

</div>

## 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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 17, 2002, 9:26pm UTC](https://forum.kirupa.com/t/tracing-instnce-name-of-button/1822/2 "2002-05-17T21:26:14Z")

</div>

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

```auto
 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 😃

pom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 18, 2002, 6:14am UTC](https://forum.kirupa.com/t/tracing-instnce-name-of-button/1822/3 "2002-05-18T06:14:45Z")

</div>

thank you for you help 🙂  
Saadat from Iran

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 18, 2002, 8:56am UTC](https://forum.kirupa.com/t/tracing-instnce-name-of-button/1822/4 "2002-05-18T08:56:35Z")

</div>

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

```auto
  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]
