# Tween not working inside function

**URL:** <https://forum.kirupa.com/t/tween-not-working-inside-function/307695>\
**Category:** Uncategorized\
**Created:** [April 8, 2010, 2:48pm UTC](https://forum.kirupa.com/t/tween-not-working-inside-function/307695 "2010-04-08T14:48:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![radams2000](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@radams2000](https://forum.kirupa.com/u/radams2000)\
**Post date:** [April 8, 2010, 2:48pm UTC](https://forum.kirupa.com/t/tween-not-working-inside-function/307695/1 "2010-04-08T14:48:37Z")

</div>

Hi  
I really can’t work out why this isn’t working  
Once i take the tween out of the function it works  
[AS]  
container.alpha = 0;

container.addEventListener(Event.ENTER\_FRAME, tweenUp);  
function tweenUp(evt:Event) {  
if (folder.currentFrame == 11) {

tweenInGallery()

}  
}  
function tweenInGallery() {  
var alphaTween:Tween = new Tween(container, “alpha”, None.easeInOut, 0, 1, 5, true);  
}  
[/AS]
