dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: pause the freaking actionscript!

  1. #1
    Senior Member
    Join Date
    May 2001
    Posts
    221

    pause the freaking actionscript!

    i have a one frame movie with all the actionscript cluttered...

    I want the actionscript to pause or delay for a few seconds from executing and then continue on its own... how can this happen?

    Thanks!
    Cheers,
    Bananaz
    Attachments are dangerous; Even in emails !!!

  2. #2
    Junior Member
    Join Date
    Sep 2001
    Posts
    26
    Maybe I'm missing something from the big picture but the obvious fix would be to set aside a corresponding number of frames before the frame with the actions in it. If your FPS is set to 18 and want a 2 second delay, insert 36 frames and then of course a stop action once the "cluttered" action frame is reached. As far as pausing or delaying in between individual actions located in the same frame ... I have no idea.

  3. #3
    Senior Member
    Join Date
    May 2001
    Posts
    221
    Thanks for the help allangles,

    but that I cud have done... my problem is that the whole movie is on the first frame...and everything runs from actionscript

    Below is my code... all of it is in one(first) frame
    is there no way we can say..... delay(500) as we do in other programming languages?

    --------------------------------------




    fscommand("fullscreen", "true");
    fscommand("showmenu", "false");
    fscommand("allowscale", "true");
    slides_xml = new XML();
    slides_xml.onLoad = startSlideShow;
    slides_xml.load("sds.xml");
    slides_xml.ignoreWhite = true;
    targetClip._alpha = 0;
    //
    // Show the first slide and intialize variables
    function startSlideShow(success) {
    if (success == true) {
    rootNode = slides_xml.firstChild;
    totalSlides = rootNode.childNodes.length;
    firstSlideNode = rootNode.firstChild;
    currentSlideNode = firstSlideNode;
    currentIndex = 1;
    updateSlide(firstSlideNode);
    }
    }
    //
    // Updates the current slide with new image and text
    function updateSlide(newSlideNode) {
    imagePath = newSlideNode.attributes.jpegURL;
    // added this to create a temp mc that can be removed
    // _root.createEmptyMovieClip("temp_mc", -500);
    // added this to get the alpha fading to work properly
    // _root.temp_mc.onEnterFrame = function()
    onEnterFrame = function () {
    if (targetClip._alpha>10 && fadeOut){
    targetClip._alpha -= 10;}
    if (targetClip._alpha<10) {
    targetClip.mohak.loadMovie(imagePath);
    targetClip2.mohak.loadMovie(imagePath);
    fadeOut = false;
    fadeIn = true;}
    if (targetClip._alpha<100 && fadeIn && !fadeOut)
    {
    targetClip._alpha += 10;}
    else {fadeIn = false;}
    if (input>30){
    input = 30;}
    slideText = newSlideNode.firstChild.nodeValue;
    styleId = newSlideNode.attributes.ID;

    if (currentIndex<30 && !fadeIn && !fadeOut) {
    fadeOut = true;
    nextSlideNode = currentSlideNode.nextSibling;
    updateSlide(nextSlideNode);
    currentSlideNode = nextSlideNode;
    }};
    }
    //
    // Event handler for 'Next slide' button
    next_btn.onRelease = function() {
    nextSlideNode = currentSlideNode.nextSibling;
    if (nextSlideNode == null) {
    break;
    } else {
    updateSlide(nextSlideNode);
    currentSlideNode = nextSlideNode;
    if (currentIndex<30 && !fadeIn && !fadeOut) {
    fadeOut = true;
    currentIndex++;
    input = currentIndex;
    }
    }
    };
    //
    // Event handler for 'Previous slide' button
    back_btn.onRelease = function() {
    previousSlideNode = currentSlideNode.previousSibling;
    if (previousSlideNode == null) {
    break;
    } else {
    currentSlideNode = previousSlideNode;
    updateSlide(previousSlideNode);
    if (currentIndex>1 && !fadeIn && !fadeOut) {
    fadeOut = true;
    currentIndex--;
    input = currentIndex;
    }
    }
    };
    Cheers,
    Bananaz
    Attachments are dangerous; Even in emails !!!

  4. #4
    Member
    Join Date
    Jul 2002
    Posts
    81
    Yes, what you want to use is the getTimer() method. It returns the number of milliseconds that have passed since the movie was started. So if you want a half-second delay in your code, just do something like:

    timer1 = getTimer();
    while(getTimer() < (timer1 + 500) { }

    this while loop will set the delay for 500 milliseconds, and then will continue executing the code aftewards.
    Good luck!

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    334
    I answered your other post too - I like setInterval....

  6. #6
    Junior Member
    Join Date
    Dec 2002
    Location
    quebec, canada
    Posts
    10

    script delay

    I am having the same sort of problem..

    I want to script to pause for a bit to let a movie clip finish playing then uload itself, then after the duration (say 2 sec) for it to load up another clip to take its place...

    it doesnt work tho... What it does is pause the movie clip for two sec then load up the other one...
    Theres none so deaf as those who will not listen...

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