A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Simple Question

  1. #1
    Registered User
    Join Date
    Jun 2000
    Location
    Woodland Hills, California
    Posts
    191

    Simple Question

    I need help with preloading a swf file that I want loaded into my main movie. Whats the best way to do this?

    Should I put the preloader in the swf I wanted loaded in or can I use the preloader on the main movie and preload the movie I am loading in?

  2. #2
    iguanagirl32 mraspiller's Avatar
    Join Date
    Jul 2002
    Posts
    817
    Here is an external preloader script:

    Make this a separate movie that preloades all the SWFs...

    Frame 1 of External Preloader Movie
    loadMovieNum("MovieToBePreloaded.swf", 1);
    loadMovieNum("AnotherMovieToBePreloaded", 2);

    Frame 2 of External Preloader Movie
    if (_level1.getBytesTotal() > 0 && _level2.getBytesTotal() > 0) {
    loaded = _level1.getBytesLoaded();
    total = _level1.getBytesTotal();
    loaded2 = _level2.getBytesLoaded();
    total2 = _level2.getBytesTotal();

    //percent = Math.round((loaded / total) * 100);
    // use this for any display of percent loaded, eg loading bar, etc
    if (loaded == total && loaded2 == total2) {
    _level1.play();
    _level1.gotoAndPlay(1);
    _level2.play();
    _level2.gotoAndPlay(4);
    }
    }

    Frame 3 of External Preloader Movie
    gotoAndPlay(2); // loop back to check the progress of the loading

    Leave Frame 4 with just an empty keyframe in it...

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