A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: simple question

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    11
    okay i got my preloader and everything working and let me explain my situation here.

    my first scene is the preloader. now after it is preloaded I want it to make a few actions before the next scene is loaded, I have scenes titled "preloader", and "main". the main scene loops, so I can't put the actions in the main scene.

    how would I call actions after the preloader is completed and before the main scene loads

    or how would I call actions ONCE after the main scene is loaded, even though the main scene loops.

    thanks!

  2. #2
    Junior Member
    Join Date
    Jun 2002
    Posts
    11
    also if this helps

    frame 1 actions of the preloader scene
    Code:
    amtLoaded = _root.getBytesLoaded()/1024;
    amtTotal = _root.getBytesTotal()/1024;
    roundLoaded = Math.round(amtLoaded);
    roundTotal = Math.round(amtTotal);
    percent = Math.round(roundLoaded/roundTotal*100);
    loadBar.gotoAndStop(percent);
    if (amtLoaded == amtTotal) {
    	gotoAndStop("main", 1);
    }
    frame 2 of preloader
    Code:
    gotoAndPlay(1);

  3. #3
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Your preloader is basicly there to preload not itself but your "main" scene and any other scene you might have in your movie. So if you want to set some actions before your "main" scene plays, just insert a scene between your preloader and the "main" scene or prolong your preloader to add whatever other actions before the "main" scene plays.

    Rather than using...

    if (amtLoaded == amtTotal) {
    gotoAndStop("main", 1);
    }

    Use...

    if (amtLoaded == amtTotal) {
    gotoAndPlay("in_between", 1);
    }

    Or...

    if (amtLoaded == amtTotal) {
    gotoAndPlay(3);
    }

    Which would be frame 3 of your preloader scene (add as many frames as you may need...), all frames that will play before you get to your "main" scene.

    One last suggestion...
    I would use if (amtLoaded >= amtTotal) {... rather than if (amtLoaded == amtTotal) {..., otherwise you may run in to trouble!

  4. #4
    Junior Member
    Join Date
    Jun 2002
    Posts
    11
    thanks heh, had to make a few changes but I got it workin!

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