dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Wait-function with Actionscritping

  1. #1
    Member
    Join Date
    May 2002
    Location
    Sweden
    Posts
    68
    When codign actionscripts, I sometimes need a pause before continuing with the script, like a waitstatement or something. But i'm not able to find any?! Is there any support in Flash for a waitstatement? Using FOR loops dosn't do the work, the pause then depends on the speed of the machine, and that isn't relieble.

    -- Mike

  2. #2
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    You can use 'setInterval' and 'clearInterval'

  3. #3
    Member
    Join Date
    May 2002
    Location
    Sweden
    Posts
    68
    Jupp, that i know. I have tested that also, it works, but it's a bit messy. Must be a better way? Or not!?

    -- Mike

  4. #4
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    did you try getTimer()

  5. #5
    Member
    Join Date
    May 2002
    Location
    Sweden
    Posts
    68
    Humm.. no i havn'y!? How do i use that one as a wait statement?

    -- Mike

  6. #6
    Member
    Join Date
    May 2002
    Location
    Sweden
    Posts
    68
    Btw! u know the difference between "function F() {...}" and "[_global.]F = function() {...}"? Havn't that figured yet

    Also i'm creating a signuppage in Flash, like where u enter your name, adress, id and pw etc. And i wanna have some variables to put it in. First i used arrays, like user[0]='name', user[1]='adress', user[2]='id' and so on. But the problem is to remeber what array containing what

    I tryes to use something like: user.name='name', user.adress='adress', user.id='id'. But i'm not sure how to do this, so it's workeble. I will try to add a function to the 'user' later on also. Like user.addUser or something.

    -- Mike

  7. #7
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    I used this script to control movement of the timeline.
    It's a timer countdown thingie.


    startTime = getTimer();

    this.onEnterFrame = function(){
    currentTime = getTimer();
    elapsedTime = Math.floor((currentTime - startTime) / 1000);
    timeRemain = 30 - elapsedTime;
    if (timeRemain == 25) {
    gotoAndStop(2);
    }
    if (timeRemain == 15) {
    gotoAndStop(3);
    }
    if (timeRemain == 5) {
    gotoAndStop(4);
    }

    if (timeRemain == -1) {
    nextFrame();
    }

    }

    It might work for you

  8. #8
    Member
    Join Date
    May 2002
    Location
    Sweden
    Posts
    68
    Humm.. it would probebly work, if i had any use for it But it's not the timeline i want to paus, but the actionscript itself. Like in BASIC u use WAIT [SEK]. U know what i meen?

    10 PRINT "Hello world.."
    20 WAIT 10
    30 PRINT "Waited for 10 sek"

    Somethink like this (it's VERY basic, i know *lol*).

    U finding a sulutions to my other problem also?

    -- Mike

  9. #9
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    My bad, I thought you wanted to pause the movie.

  10. #10
    Member
    Join Date
    May 2002
    Location
    Sweden
    Posts
    68
    Hehe.. naaa, that i already know how to do

    -- Mike

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