A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Pause for X seconds

  1. #1
    Hi,
    Very sorry for the long post but.....

    I posted this earlier but without any luck, I've been working on it for a full day now but I can't figure it out.

    What I want to do is:

    Have a frame where I want to pause the movie for 5 seconds or so before it carries on to the next frame.
    I can't work it out to save my life, any help would be greatly, and I mean greatly, appreciated.

    As an added bonus, can you hold on a frame until theres an interaction, ie.

    hold on frame until keypress 'space'?

    or something similar, I'm an absolute actionscript newbie so I'd love any help.


    thanks in advance

    Danny



    <Copy of part of previous post>

    >Hi,

    >I usually use director for my multimedia but have started to try and learn a bit about flash.

    >For a loop in director I just use the library behaivour loop for X seconds then jump to marker name ''

    >Is it possible to do this in Flash MX and if so how. I'm sure these are easy ones for all you gurus so I'm sorry to waste your time but I can't figure it out at all

    >I've tried the following code but to no avail.

    >var x = 0;
    >setInterval(myfunc(),480);


    >function myfunc() {
    >if(x==0) {
    >stop();
    >x++;
    >}
    >else {
    >gotoAndPlay(45);
    >clearInterval...
    >}
    >}
    >Thanks, I have tried this, I had to take the ... from the end of clearInterval to get it to run, again it pauses the movie but then refuses to carry on.
    >I also tried changing the clearInterval line to

    >clearInterval(myfunc(),480);

    >again with no luck.

    >Any more help you can give would be greatly appreciated.

    >One newbie going completely out of his mind.....

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    682

    I can name that tune in three frames

    I have a simple way to do it, but it requires at least three frames.

    Frame One:

    startTime=getTimer();
    endTime=startTime+5000;

    Frame Two:

    Blank - nothing on frame two - nada

    Frame Three:

    startTime=getTimer();
    if (startTime>endTime) {nextFrame()}
    else {_root.gotoAndPlay(2)}

    Nothing fancy, but it works.

    Kennyb

  3. #3
    HI,

    I tried this by just extending the relevant section by 2 frames and then adding 3 successive keyframes and adding your code to the first and the last.
    When it gets to the frame though it just jumps back to the beginning of the scene.

    Is there anywhere I could send you the FLA.

    I'm at at my wits end.

    oh what I'd give for a director like library.


    Thanks

    Danny

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    Sure, send it to: aspirin99@hotmail.com

  5. #5
    thanks, its on its way!

  6. #6
    gah! the file is 2 meg in size and got refused 'cos it exceeded the file size limit

    I've tried cutting out all the other scenes and all the unnecesary frames but it won't seem to reduce from 2 meg :/

    wierd.

    zipped is 1.24 meg which is still too big for hotmail isn't it?

    any other ideas?

    cheers


  7. #7
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    Can you post is some place where I can download it?

  8. #8
    Hiya,

    hehe, never thought of that...

    I'll email you the address

  9. #9
    Hi again,

    After many hours of trying i have finally figured it out...

    Solution is below for anyone else with the same problem...




    Create a new movie clip

    (insert, new symbol, movie clip)

    name it 'time_clip'

    on frame one add the following code

    mainStopTime = _level0.stoppedTime
    pauseTime = 5000
    _level0.stop()
    if (getTimer() >= (pauseTime + mainStopTime)) {
    _level0.play();
    }

    add a second blank frame, not a keyframe!!

    return to main timeline and add on the frame you want to pause

    stoppedTime = getTimer();

    That'll do it!

  10. #10
    Senior Member
    Join Date
    Apr 2002
    Posts
    682
    Well... I coded the FLA you posted for me, but I see you figured something out. Anyway, you might take a look at the one I did. I also included the spacebar press to go to the next image.

    Also, just FYI - there are easier and cleaner ways to do what you are trying to do. For example, if you were to put each animation into its own MC, you could control the amount of display time for each image by number of frames. You could then call the animation at the complition of the previous.

    You updated FLA can be dl at:

    aspirin99.guardianhosting.net/misc

    Please let me know once you have the file - or whether or not you want it. I'm running low on space.

  11. #11
    Hi again,

    I'm downloading the .fla now, thanks for your help mate.

    I really appreciate it

    Danny

  12. #12

    Smile

    Also, the way I resolved it, for those who are following the same problem can be found here.

    http://www.dt-creations.co.uk/tutorials/pause.zip

    Its a .txt file zipped up, only a few k. I wrote a small tutorial to help other beginners like myself.


    Cheers again for the help

    Danny

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