A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: is this code too fast for flash?

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Location
    Virginia, USA
    Posts
    437

    is this code too fast for flash?

    I have a stop watch app, and in there are 2 two frames i am having trouble with.

    at frame 31, I have this code:

    Now = Number((getTimer()-StartTime))+Number(SavedTime);

    at frame 32, I have this code:

    gotoAndPlay("Display Time");

    and everything work fine, but if I move the code from 32 to 31 to have something like this:

    Now = Number((getTimer()-StartTime))+Number(SavedTime);
    gotoAndPlay("Display Time");

    Then Flash will run into trouble, and ask me to abort the script.

    Oh, one more thing. Here is the code from Display Time frame, and Get Time frame is the frame 31:

    if (Number(Now)>1000) {
    Minutes = int((substring(Now, 1, (length(Now)-3)))/60);
    Seconds = int((substring(Now, 1, (length(Now)-3)))-(Minutes*60));
    }
    Centiseconds = int(substring(Now, (length(Now)-2), 2));
    if (Number(Centiseconds)<10) {
    Centiseconds = "0" add Centiseconds;
    }
    if (Number(Seconds)<10) {
    Seconds = "0" add Seconds;
    }
    if (Number(Minutes)<10) {
    Minutes = "0" add Minutes;
    }
    if (Number(int(Minutes))>59) {
    call("Reset");
    }
    gotoAndPlay("Get Time");
    Still looking for a freelancer to work on my footer!

  2. #2
    I'm guessing that frame 31 is labeled "Display Time", right?

    That would cause an infinite loop because flash keeps going to that same frame. Flash will wait until all operations are done before displaying the information, so an infinite loop causes no info to be displayed and flash asks if you want to abort the script.

    either seperate it into 2 frames or use onEnterFrame if you have MX

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Location
    Virginia, USA
    Posts
    437
    "Display Time" is frame 40 and in which the var Now is needed.

    all i can think of is this line

    Now = Number((getTimer()-StartTime))+Number(SavedTime);

    is not completed yet before it executed the next line:

    gotoAndPlay("Display Time");
    Still looking for a freelancer to work on my footer!

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