SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    426
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Preloading a movie that externally loads JPGs

    Hi

    I want to preload a dynamic number of JPGs (number determined from an external file) and run them as fading in and out images. I want to preload the entire movie before playing and want to know the best way of doing this. My ActionScript is a bit rusty but the way I see it is there are a couple of ways and want to know if one is better than the other.

    1. Have one movie clip the fade in and fades out and then loads a new one via loadMovie(). My question with this is once it has looped through the series of images once and and calls loadMovie() for a previously loaded .jpg will it load it again?

    2. Have a dynamic movie clip per image and do it that way. This would use loadMovie() only once per image.

    My further question with regard to the above approaches is if you have a preloader on frame 1 of the root movie when it gets the total bytes of the movie does it take into account the externally loaded jpgs?

    Flash 8 AS 2.0 by the way.

    Hope that makes sense.

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,547
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by DrQuincy View Post
    1. Have one movie clip the fade in and fades out and then loads a new one via loadMovie(). My question with this is once it has looped through the series of images once and and calls loadMovie() for a previously loaded .jpg will it load it again?
    It should load from the browser cache. I'd use movieClipLoader instead of loadMovie so you can monitor load success and instigate the fade in only when successful- otherwise you'll fade in the clip when the image hasn't loaded yet, and it may suddenly appear abruptly on loading after the fade has taken place.

    Quote Originally Posted by DrQuincy View Post
    2. Have a dynamic movie clip per image and do it that way. This would use loadMovie() only once per image.
    My further question with regard to the above approaches is if you have a preloader on frame 1 of the root movie when it gets the total bytes of the movie does it take into account the externally loaded jpgs?
    No externally loaded data isn't included when using getBytesTotal/Loaded.

  3. #3
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    426
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I've experimented with it and you're absolutely right. I didn't seem to get any caching using 1. though.

    I did (after much hair-pulling) managed to pre-load all the external jpgs too.

    One question, what's the difference between movieClipLoader and loadMovie?

  4. #4
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,547
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    You might not get caching if your testing within the flash application as opposed to within the browser.

    movieClipLoader is a class that has better methods/event handling so you can monitor what's occurring during a load process (how much has loaded, has an error occurred etc) whereas the loadMovie method of the movieclip class has no such capabilities - you can only start loading but can't monitor what happens subsequently.

  5. #5
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    426
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by EastCoast View Post
    You might not get caching if your testing within the flash application as opposed to within the browser.

    movieClipLoader is a class that has better methods/event handling so you can monitor what's occurring during a load process (how much has loaded, has an error occurred etc) whereas the loadMovie method of the movieclip class has no such capabilities - you can only start loading but can't monitor what happens subsequently.
    Ah, I see.

    Well I sort of have it working now. I just looped through the movie clips until all bytes were loaded for all moves then progressed to the next frame. I suppose since I don't need to inherit ant MC properties that works fine here. I might try changing to movieClipLoader just so I know both methods.

    Thanks for your help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •