# OnPress not working

**URL:** <https://forum.kirupa.com/t/onpress-not-working/24158>\
**Category:** Uncategorized\
**Created:** [June 26, 2003, 6:13pm UTC](https://forum.kirupa.com/t/onpress-not-working/24158 "2003-06-26T18:13:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![7of9](https://avatars.discourse-cdn.com/v4/letter/7/c89c15/32.png) [@7of9](https://forum.kirupa.com/u/7of9)\
**Post date:** [June 26, 2003, 6:13pm UTC](https://forum.kirupa.com/t/onpress-not-working/24158/1 "2003-06-26T18:13:50Z")

</div>

I have the following code it all works great but When I click on a specific tab button it always displays “postings”. Weird it should display the name of the tab button, according to my onpress function. help.

menuArray = [“currentInfo”, “News”, “Sports”, “Postings”];

\_global.xyz = function () {

mLen = menuArray.length;

for (i=0; i \< mLen; i++)

{

```
  myName=menuArray*;
  var x= attachMovie("Tab_Mc", myName , i*10);
  x._x = i * x._width;
  x._y = 200;
  x.name= myName;
  x._alpha = 80;
  x.TabText= myName; //Textbox inside the Mc
  x.arraycntr= i;
 
  x.onPress = function() 
    { 
       trace(x.name);
    }

```

}

}

// instantiate the onLoad() redefinition  
xyz();

---

<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:** [June 26, 2003, 6:23pm UTC](https://forum.kirupa.com/t/onpress-not-working/24158/2 "2003-06-26T18:23:37Z")

</div>

x.onPress = function()  
{  
trace(this.name);  
}

---

<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:** [June 26, 2003, 6:38pm UTC](https://forum.kirupa.com/t/onpress-not-working/24158/3 "2003-06-26T18:38:35Z")

</div>

thanks…I knew it was something simple…many thanks again.
