A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Loader in parent or child!!!

  1. #1
    Wanna emigrate :)
    Join Date
    Aug 2001
    Location
    Romania
    Posts
    146

    Loader in parent or child!!!

    Hello everyone,
    I have a question and i need your help.
    I made a movie with buttons that calls other movies with the LoadMovie
    action. The question is were i should put the preloaders for those movies???
    "If i was a king, i could do anithyng!"

  2. #2
    Mom said "make me a Mod" el-Ignoramus's Avatar
    Join Date
    Oct 2002
    Location
    Xanadu
    Posts
    1,772
    hi there

    place them in the main movieclip that the others load in. this way it's there whenever needed and you won't add more KB to the loaded movies

    hope that helped

  3. #3
    Wanna emigrate :)
    Join Date
    Aug 2001
    Location
    Romania
    Posts
    146

    Thank's but...

    I understand but...now the problem is how will i make the preloaders?
    I know how to make a loader for one movie (with a scene that preload the movie!) but where i should put the preloaders for all the other movies?
    By making a scene with an action script that preload the all 4 movies or what?
    "If i was a king, i could do anithyng!"

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    You could make a movie clip that contains the preloader for all the other movies, (give this the instance name preloader) in frame 1 of this movie clip leave a blank keyframe with just a stop(); action attached, this will hide the preloader until it is needed.

    next in frame 2 of the clip add some actions,

    Code:
    if (_root[loaderClip].getBytesTotal() > 0 && _root[loaderClip].getBytesLoaded() > 0) {
         var loaded = _root[loaderClip].getBytesLoaded();
         var total = _root[loaderClip].getBytesTotal();
         var percent = Math.round((loaded / total) * 100);
         // using the percent variable you can make a loading bar or a message to tell the user how much is downloaded
         if (loaded == total) {
              _root[loaderClip].play(); // start the loaded movie
              this.gotoAndStop(1); // hide the preloader again     
         }
    }
    in frame 3 you can loop back to frame 2 to keep running the preloader.

    now to trigger this preloader when you want to load a movie you can use something like,

    _root.myClip.loadMovie("filename.swf"); // load filename.swf into myClip
    _root.preloader.loaderClip = "myClip"; // tell the preloader what clip the movie is being loaded into
    _root.preloader.play(); // start the preloader

    edit]oops I forgot, make sure you have a stop(); action in frame 1 of each movie you load, otherwise it will try to play straight away regardless of the preloader

  5. #5
    Wanna emigrate :)
    Join Date
    Aug 2001
    Location
    Romania
    Posts
    146

    ;)

    Thanx guy's...couldn't make it without your help
    "If i was a king, i could do anithyng!"

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