# Help with AS button!

**URL:** https://forum.kirupa.com/t/help-with-as-button/194425
**Category:** flash
**Created:** [July 23, 2006, 10:05am UTC](https://forum.kirupa.com/t/help-with-as-button/194425 "2006-07-23T10:05:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kjhgvbnmk](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@kjhgvbnmk](https://forum.kirupa.com/u/kjhgvbnmk)
#### Post date: [July 23, 2006, 10:05am UTC](https://forum.kirupa.com/t/help-with-as-button/194425/1 "2006-07-23T10:05:36Z")

</div>

Hello,

I’m pretty new to AS so sorry if it’s a bit of a newbie question! - I’m using the MC tween method to do all my animations and buttons but am having problems with the example text I have been given:

#include “mc\_tween2.as”

var myButtons = [this.myButton\_1, this.myButton\_2, this.myButton\_3, this.myButton\_4];

for (var i=0; i\<myButtons.length; i++) {

```
myButtons*.originalY = myButtons*._y;

myButtons*.onRollOver = function() {
    this.tween("_y", this.originalY + 10, 1);
};

myButtons*.onRollout = myButtons*.onReleaseOutside = function() {
    this.tween("_y", this.originalY, 0.5);
};

```

[COLOR=Red]  
myButtons\*.onRelease = function() {  
this.\_parent.activateItem (this);

```
    trace ("Hey, button "+this+" was clicked.");
};[/COLOR]

```

}

this.activateItem = function(item) {

```
if (this.currentItem != false) this.deActivateItem();

this.currentItem = item;
this.currentItem.alphaTo (50, 1);
this.currentItem.enabled = false; 

```

};

this.deActivateItem = function() {  
this.currentItem.enabled = true;  
this.currentItem.alphaTo (100, 0.5);  
this.currentItem.tween("\_y", this.currentItem.originalY, 0.5)  
this.currentItem = undefined;  
};

this.stop();

What I am having trouble getting to grips with is in red. How do I give different actions to each button (one open window one and the other opens window 2 for example)? When I try this code, each button does the same thing and I can’t figure out what I’m meant to be doing to change that!

Thanks 😏
