SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    Cambridge, England
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with using a delay loop

    I'm having big problems with this animation http://www.step-up-to-science.com/so...rrent2.fla.zip. *I've grouped all the main objects that I want to animate into one movie clip 'anim1'. *Each of the objects are spaced one frame apart in 'anim1'. *The first part works OK. *The two planets move together, but when they collide, I've tried to introduce some collision effects spaced apart by using a delay movieclip, which then sends it back to the anim1 timeline. *This doesn't seem to be working as the collision effects all happen at the same time. *I can't understand it, as I've used stop(); at every frame on the 'scripts' layer of the 'anim1' timeline and I can't see how I've addressed the 'delay' movieclip incorrectly.

    If someone could help, I'd be very grateful!

    Philippa

  2. #2
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    Cambridge, England
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I found a solution. Rather than directing the playhead at a delay movieclip, which then ran for a number of frames, before bringing in the next object, I am now using 'Get Timer".

    As an object is brought in, and where I want a delay between that and the next object I have attached the script below to its 'onload' and 'enterframe' handler. This also has the advantage that I can vary the amount of delay between each object.

    onClipEvent (load) {
    var elapsed = 0;
    }


    onClipEvent (enterFrame) {


    //Play two-second delay loop

    var delay = 2;
    startTime = getTimer();
    while (_root.anim1.Impact3_back.elapsed < delay) { //open WHILE LOOP 1.1
    currentTime = getTimer();
    _root.anim1.Impact3_back.elapsed = (currentTime - startTime)/1000; //calculates elapsed time in seconds
    } //close WHILE LOOP 1.1


    _root.anim1.nextFrame();
    }

    Philippa


Bookmarks

Posting Permissions

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