delaying statements - Macromedia Flash

This is a discussion on delaying statements - Macromedia Flash ; I've read some of the topics on delaying statements in this forum, but am still confused. I want to use an alpha tween on a movieclip and once the tween finished, I want the movieclip to wait 5 seconds before ...

+ Reply to Thread
Results 1 to 4 of 4

delaying statements

  1. Default delaying statements

    I've read some of the topics on delaying statements in this forum, but am still
    confused. I want to use an alpha tween on a movieclip and once the tween
    finished, I want the movieclip to wait 5 seconds before it reverses tween. My
    code is as follows:



    Thank you in advance!

    myTween = new Tween(mc_1, "_alpha", easeNone, 0, 100, .5, true);
    myTween.onMotionFinished = function():Void
    {
    // I need code here that will delay the following statement by 5 seconds.

    myTween.yoyo();
    }


  2. Default Re: delaying statements

    I created an example of what you can do
    http://www.shan-dysigns.com/flash/alphaYoYo.fla. I made a note in the code and
    also placed a box on the stage to show you what's going on. Let me know if this
    helps yoyo, I mean you... that was funny...


  3. Default Re: delaying statements

    Shandy, I appreciate the time and effort you put into responding to my posting.
    Thank you. I'm a newbee to AS, so I don't quite understand all the lines in
    the code you provided me. I kept researching this issue after submitting my
    posting and was able to use the code below that seems to do the same thing.

    I've now ran into another issue . Now that I have mc_1 fading in/out, I
    want it to fade in, wait for 5 seconds, fade out, and wait for 20 seconds
    before looping. Currently, the amount of time that it waits between fading in
    and fading out is the same. In other words, I want mc_1 to be fully visible
    for 5 seconds and once it fades out, fully invisible for 20 seconds, and then
    loop again. I hope this makes sense.

    Thanks again Shandy.

    myFunction = function():Void
    {
    myTween = new Tween(mc_1, "_alpha", easeNone, 10, 100, 2, true);
    myTween.onMotionFinished = function():Void
    {
    setTimeout(delayYoyo, 5000); // delays myTween.yoyo for 5 secs.
    }
    delayYoyo = function():Void
    {
    myTween.yoyo();
    }
    }

    myFunction();


  4. Default Re: delaying statements

    The script you attached is just another way to do it (a little more compact in
    design), but whichever way you understand is best. I took the code you attached
    and added additional code to create the effect you want. I added notes within
    the code. You can re-download that link for the new flash file. Let me know if
    this is what you are after.


+ Reply to Thread