# Tween function

**URL:** <https://forum.kirupa.com/t/tween-function/314328>\
**Category:** Uncategorized\
**Created:** [September 24, 2010, 7:10pm UTC](https://forum.kirupa.com/t/tween-function/314328 "2010-09-24T19:10:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashmodeon](https://avatars.discourse-cdn.com/v4/letter/f/0ea827/32.png) [@flashmodeon](https://forum.kirupa.com/u/flashmodeon)\
**Post date:** [September 24, 2010, 7:10pm UTC](https://forum.kirupa.com/t/tween-function/314328/1 "2010-09-24T19:10:37Z")

</div>

Hello,

I wrote the code for a tween function called fadeOut. As you can understand, its end is to fade out the alpha property of an instance.

the code uses an addEventListener:

chooseBlue\_btn.addEventListener(MouseEvent.CLICK, fadeOut);

so when the button named chooseBlue\_btn is clicked the fadeOut is called:

function fadeOut(e:Event):void  
{  
chooseRed.x +=1 ;  
var tweenfadeOut:Tween = new Tween(buttonV, “alpha”, None.easeOut, 1, 0, 3, true);  
}

But I would like to call fadeOut when the clip starts without using a button.  
In which way?

Thank you.
