A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: check that a SWF has fully loaded?

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    17
    want to dynamically load a sequence of SWFs into a movie.

    each movie is called inf1.swf... inf2.swf etc.

    so I create a loop with "i":

    loadMovie ("inf"+i+".swf", "_root.loader");

    but.. how do I check if the SWF is fully loaded, so I can i++ and load the next one in the sequence?

    I tried onClipEvent(data), but I think the SWF is streaming the data, because it registers as TRUE as soon as the SWF loads in..

    anyone .... anyone....?


  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    atlanta
    Posts
    1,008
    you need a preloader in there somewhere. i don't think you can load multiple swfs at the same time, they need to be loaded one at a time. something has to tell your script that one movie is loaded and the next one is ready. guess you know that, not sure how exactly to preload and communicate with the loading loop...shouldn't be too hard to figure out.

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Posts
    17
    hmmmm

    was thinking.. I reckon I could just use bytesloaded to figure out when each movie in the sequence is loaded in.. but.. of course, if the page was cached, this system would fail.. so .. I suppose I will have to delete cache onLoad the HTML..

    hmmmmm...

    might work..


  4. #4
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835
    hi,

    from your last post it seems that you want to check when the external swf has finished playing, is that true?

    In that case, create a function that will load the next swf, use a variable to keep track of which swf is next and trigger the 'load next' from the last frame of the external swf, something like so:

    Code:
    // frame 1
    movies = ["inf1.swf","inf2.swf","inf3.swf"];
    nextMovie = 0; // array index of next movie
    
    function loadNextMovie ()
    {
       if(nextMovie >= movies.length)
       {
          trace("no more movies to load!");
          return;
       }
    
       // load next movie
       _root.loader.loadMovie(movies[nextMovie]);
       nextMovie++; // move along to next movie
    }
    
    // last frame of each external movie
    _root.loadNextMovie();
    (you may want to insert a blank frame after the last 'real' frame of each external swf and place the code on that, so that the actual last frame is displayed).

    - n.

  5. #5
    Junior Member
    Join Date
    Oct 2001
    Posts
    17
    thanks. reckon that'll do it nicely. : ]

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