# Tween.delay()

**URL:** <https://forum.kirupa.com/t/tween-delay/243250>\
**Category:** flash\
**Created:** [November 5, 2007, 2:07am UTC](https://forum.kirupa.com/t/tween-delay/243250 "2007-11-05T02:07:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ariff](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@Ariff](https://forum.kirupa.com/u/Ariff)\
**Post date:** [November 5, 2007, 2:07am UTC](https://forum.kirupa.com/t/tween-delay/243250/1 "2007-11-05T02:07:39Z")

</div>

Hi Kirupa,

i have several dynamic textfields on stage on which i call an alphaTween function. Depending on some parameters, i made my function sort of dynamic, so i can pass the “motion” (up or down) to it, which makes the alpha go from 0-\>1 or vice versa. Now i call this function on several textFields, so when i start my movie, all my textFields tween there alpha’s synced to eachother. I wanted to some sort of “delay” them so that my top textfield alphaTweens first, second one, third one, and so on… Im not an actionscript specialist, as i have only recently switched to 3.0. Looking around for some ideas on how i could manage to do this (without using custom classes from someone else) i have been thinking that the Timer() class should be the way to go. Although if i understand everything right, the Timer, once set, starts running, and than fires a certain function on a certain amount of time. So “basically” setup, the timer would just delay the alphaTweens, and once it times-out, it would fire the alphaTween function on my textField objects, resulting in another “synced” alphaTween… So that’s not quite the way to go. I have been thinking about “nesting” several timers, but im not sure if thats a good idea…

anyone who wants to think along, or could push me into the right direction ?

kind regards  
Juan

[AS]  
import fl.transitions.Tween;  
import fl.transitions.easing.\*;

alphaTweenText(demoTextField, “up”);  
alphaTweenText(demoTextField2, “dn”);  
alphaTweenText(demoTextField3, “up”);

function alphaTweenText(alphaTarget:TextField, alphaMotion:String):void  
{  
if (alphaMotion == “up”){  
var alphaTweenUp:Tween = new Tween(alphaTarget, “alpha”, None.easeNone, 0, 1, 1, true);  
}  
else {  
var alphaTweenDn:Tween = new Tween(alphaTarget, “alpha”, None.easeNone, 1, 0, 1, true);  
}  
}  
[/AS]

ps : wouldnt it be better to change the function parameter alphaName:TextField to alphaName:Object, so i can use the function for all objects instead of only TextFields ?

ps : i have just thought of some sort of “workaround” by adding a third parameter for the function to accept, alphaTime and increase it for eg. demoTextField2… it would take a bit longer to finish the Tween, but than again, it will still start at the exact same moment, and thats exactly what i want to avoid.
