# Dynamic referencing on onRelease

**URL:** <https://forum.kirupa.com/t/dynamic-referencing-on-onrelease/274120>\
**Category:** flash\
**Created:** [October 25, 2008, 1:50am UTC](https://forum.kirupa.com/t/dynamic-referencing-on-onrelease/274120 "2008-10-25T01:50:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wolcotter](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@wolcotter](https://forum.kirupa.com/u/wolcotter)\
**Post date:** [October 25, 2008, 1:50am UTC](https://forum.kirupa.com/t/dynamic-referencing-on-onrelease/274120/1 "2008-10-25T01:50:11Z")

</div>

The following code is my attempt to fade out current clip then to fade in selected clip via one onRelease command. Here’s the code. Can someone set me straight?

```auto
import gs.TweenLite;
import gs.easing.*;

var whoIsOn:Number = 0;
var clip:Array = ["orange","cranberry","melon","mango"];

this.attachMovie("btn","meenie", getNextHighestDepth(), {_x:150, _y:451});
this.attachMovie("btn","minie", getNextHighestDepth(), {_x:236, _y:451});
this.attachMovie("btn","moe", getNextHighestDepth(), {_x:322, _y:451});

this.attachMovie("orange","orange", getNextHighestDepth(), {_x:275, _y:411, _alpha:0});
this.attachMovie("cranberry","cranberry", getNextHighestDepth(), {_x:275, _y:411, _alpha:0});
this.attachMovie("melon","melon", getNextHighestDepth(), {_x:270, _y:420, _alpha:0});

meenie.onRelease = function() {
    if (whoIsOn == 0) {
        TweenLite.to(orange, 1, {_alpha:100});
    } else {
        TweenLite.to(clip[whoIsOn], 1, {_alpha:0});
        TweenLite.to(orange, 1, {_alpha:100,delay:1});
    }
};

meenie.onRollOver = function() {
    this._alpha = 40;
};

meenie.onRollOut = function() {
    this._alpha = 100;
};

minie.onRelease = function() {
    if (whoIsOn == 0) {
        TweenLite.to(cranberry, 1, {_alpha:100});
    } else {
        TweenLite.to(clip[whoIsOn], 1, {_alpha:0});
        TweenLite.to(cranberry, 1, {_alpha:100,delay:1});
    }
};

minie.onRollOver = function() {
    this._alpha = 40;
};

minie.onRollOut = function() {
    this._alpha = 100;
};

moe.onRelease = function() {
    if (whoIsOn == 0) {
        TweenLite.to(melon, 1, {_alpha:100});
    } else {
        TweenLite.to(clip[whoIsOn], 1, {_alpha:0});
        TweenLite.to(melon, 1, {_alpha:100,delay:1});
    }
};

moe.onRollOver = function() {
    this._alpha = 40;
};

moe.onRollOut = function() {
    this._alpha = 100;
}; 

```

```
 Thanks / help appreciated
```
