views:

847

answers:

2

Here is my script... all I want to do is have it continuously loop!

import fl.transitions.Tween;

import fl.transitions.easing.*;

yourwebsite_mc.visible=false;
var uptodateFadeTween=new Tween(uptodate_mc,"alpha",Strong.easeOut,0,1,3,true);
var uptodateRotateTween=new Tween(uptodate_mc,"rotation",Strong.easeOut,360,0,3,true);
var uptodateXTween:Tween=new Tween(uptodate_mc,"x",Strong.easeOut,-250,200,3,true);


var uptodateDone:Timer=new Timer(3000,1);
uptodateDone.addEventListener(TimerEvent.TIMER, timerDoneF);
uptodateDone.start();

function timerDoneF(e:TimerEvent):void {
    var uptodateYTween:Tween=new Tween(uptodate_mc,"y",Strong.easeOut,129,-150,3,true);

}

var uptodateFlyUp:Timer=new Timer(3500,1);
uptodateFlyUp.addEventListener(TimerEvent.TIMER, timerDoneG);
uptodateFlyUp.start();


function timerDoneG(e:TimerEvent):void {
    yourwebsite_mc.visible=true;
    var yourwebsiteXTween:Tween=new Tween(yourwebsite_mc,"x",Strong.easeOut,-200,450,1.5,true);
}
+3  A: 

I'm not sure what exactly you want to loop continuously so here's a shot in the dark...

You can define a continuous loop like so:

addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(e:Event):void
{
    // any code in here will execute every frame
}

If you want each of your timers to run forever just modify your code to the following:

var uptodateDone:Timer = new Timer(3000);
uptodateDone.addEventListener(TimerEvent.TIMER, timerDoneF);
uptodateDone.start();

and

var uptodateFlyUp:Timer=new Timer(3500);
uptodateFlyUp.addEventListener(TimerEvent.TIMER, timerDoneG);
uptodateFlyUp.start();

This will result in timerDoneF being called every 3000 milliseconds and timerDoneG being called every 3500 milliseconds forever. Hope this is helpful. Good luck!

heavilyinvolved
there is basically 2 times events going on, with 2 different pieces of texts flying around. once it complete, i would like it to start over from the beginning. removing the 1 from new Timer(3000, 1) was a cool trick, which it made it happen every 3seconds, but the other timer was happening every 3.5 seconds and they started to interfere.thanks for you advice -- i already learned something new today, but i'd really just like this code to keep repeating itself once its finished.
Ross
another thing i've just tried is i made the whole proejct run as a timer, so ever 6.5 seconds it would restart... it's kind of working, but some of the text is out of place... any other tips would be greatly appreciated!
Ross
A: 

ok heres what i did now. i made the action run normally with different timers... then i made the action again run on a timer to run after the initial set completes. its not 100% what i wanted, but pretty close. sorry for being a noob --- if anyone else has any reccomendations, please let me know.

import fl.transitions.Tween;
import fl.transitions.easing.*;

yourwebsite_mc.visible = false;

var uptodateFadeTween =new Tween(uptodate_mc, "alpha", Strong.easeOut, 0, 1, 3, true);
var uptodateRotateTween = new Tween(uptodate_mc, "rotation", Strong.easeOut, 360, 0, 3, true);
var uptodateXTween:Tween = new Tween(uptodate_mc, "x", Strong.easeOut, -250, 200, 3, true);

var uptodateDone:Timer = new Timer (3000, 1);
uptodateDone.addEventListener (TimerEvent.TIMER, timerDoneA);
uptodateDone.start();

function timerDoneA(e:TimerEvent):void{
    var uptodateYTween:Tween = new Tween(uptodate_mc, "y", Strong.easeOut, 129, -250, 3, true);

}

var uptodateFlyUp:Timer = new Timer (3500, 1);
uptodateFlyUp.addEventListener(TimerEvent.TIMER, timerDoneB);
uptodateFlyUp.start();

function timerDoneB(e:TimerEvent):void{
    yourwebsite_mc.visible = true;
    var yourwebsiteXTween:Tween = new Tween(yourwebsite_mc, "x", Strong.easeOut, -200, 450, 4, true);

}

var uptodateprojectDone:Timer = new Timer (7500)
uptodateprojectDone.addEventListener (TimerEvent.TIMER, timerDoneH);
uptodateprojectDone.start();

function timerDoneH(e:TimerEvent): void{

uptodate_mc.x = 192.6
uptodate_mc.y = 129
uptodate_mc.visible = true;
yourwebsite_mc.visible = false;

var uptodateFadeTween =new Tween(uptodate_mc, "alpha", Strong.easeOut, 0, 1, 3, true);
var uptodateRotateTween = new Tween(uptodate_mc, "rotation", Strong.easeOut, 360, 0, 3, true);
var uptodateXTween:Tween = new Tween(uptodate_mc, "x", Strong.easeOut, -250, 200, 3, true);


var uptodateDone:Timer = new Timer (3000, 1);
uptodateDone.addEventListener (TimerEvent.TIMER, timerDoneF);
uptodateDone.start();

function timerDoneF(e:TimerEvent):void{
    var uptodateYTween:Tween = new Tween(uptodate_mc, "y", Strong.easeOut, 129, -250, 3, true);

}

var uptodateFlyUp:Timer = new Timer (3500, 1);
uptodateFlyUp.addEventListener(TimerEvent.TIMER, timerDoneG);
uptodateFlyUp.start();

function timerDoneG(e:TimerEvent):void{
    yourwebsite_mc.visible = true;
    var yourwebsiteXTween:Tween = new Tween(yourwebsite_mc, "x", Strong.easeOut, -200, 450, 4, true);

}
}
Ross