A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to do a time delay?

  1. #1

    How to do a time delay?

    So on frames 10, 20, and 30 on my timeline I have these llines of code on each of them respectively:

    pic1.shiverIn(100, 100, .6, .4, .7, 100, 20);
    pic2.shiverIn(100, 100, .6, .4, .7, 100, 20);
    pic3.shiverIn(100, 100, .6, .4, .7, 100, 20);

    This essentially "bounces" on my images. Can someone give me direction on how to set up a delay to make this happen all on one frame?



    Here is the function:
    MovieClip.prototype.shiverIn = function(xScale, yScale, strength, weight, time, amount, speed)
    {
    var xScaleStep = 0;
    var yScaleStep = 0;
    var count = 0;
    var fps = 30;

    this.onEnterFrame = function()
    {
    xScaleStep = Math.round((xScale-this._xscale)*strength+xScaleStep*weight);
    yScaleStep = Math.round((yScale-this._yscale)*strength+yScaleStep*weight);

    this._xscale += xScaleStep;
    this._yscale += yScaleStep;

    count++;

    if (this._alpha < amount)
    {
    this._alpha += speed;
    }

    if (xScaleStep == 0 && yScaleStep == 0 && count>=fps*time)
    {
    count = 0;
    delete this.onEnterFrame;
    }
    }
    }

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    look up setInterval

  3. #3
    I ended up doing it with TweenMax and its delay properties. Worked out pretty well.

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    cool.

    caurina Tweener is another good one too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center