A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Preloader for local flash movie?

  1. #1
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371

    Preloader for local flash movie?

    Hello,

    I'm creating a presentation that will consist of external swfs that will be loaded into a 'shell' that contols loading, sound, auto advancing etc. The application will initally be delivered on the web and then later on cd using the local flash player (without browser window). How will preloaders preform in this situation, I know that I cannot use the MovieClipLoader Class, as it doesnt work properly with local files... Please provide any insite that you may have

    Thank you much!

    Josh

  2. #2
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    A preloader will work just as it does on the web...just a ton faster. I used to think that you needed a preloader for projectors so all of mine for a while had them. They worked just fine.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  3. #3
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Actually, without a server, your preloader won't work as expected. When you load files locally they are read into the player entirely before you get a byte count so you'll go immediately from 0 to 100%. For small files or when you're loading from CD the effect isn't noticeable, but when you load from a CD the preloader will appear to be stalled.

  4. #4
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    Thanks NorthCode... So a solution would be to use a preloader that doesnt look at the byte information but rather works like this:

    1. button is cliked to load swf
    2. show 'looping preloader' (no bye count)
    3. when movie has indeed fully loaded, hide looping preloader.

    this seems like a solid approch to me, how about you?

    PS. i dont think it has to do with having, or not having a server to serve up the files, but rather if it is the standalone flash player playing the files, OR the browser plugin playing the files. Do you agree?

    Thanks again,
    Josh

  5. #5
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    PS. i dont think it has to do with having, or not having a server to serve up the files, but rather if it is the standalone flash player playing the files, OR the browser plugin playing the files. Do you agree?
    Nope. If you put a large file with a preloader on a network drive (to get some latency) and then drop it on a browser window you won't see the preloader move because it doesn't get the information it needs, when the browser plugin tries to load a local file it just pulls it all in like the standalone player does. A server is required for the preloader to work.

    So a solution would be to use a preloader that doesnt look at the byte information but rather works like this:
    1. button is cliked to load swf
    2. show 'looping preloader' (no bye count)
    3. when movie has indeed fully loaded, hide looping preloader.
    If the preloader is part of the movie you then yt won't work, the SWF won't start playing until the entire file has been loaded into memory. If your preloaded does a loadMovie and loads an SWF into a target clip/level you can show a "loading" message, but I'm not 100% sure the player won't freeze up while it's loading the movie into the target clip/level.

  6. #6
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    Nope. If you put a large file with a preloader on a network drive (to get some latency) and then drop it on a browser window you won't see the preloader move because it doesn't get the information it needs, when the browser plugin tries to load a local file it just pulls it all in like the standalone player does. A server is required for the preloader to work.
    Have you actually tried this, or are you predicting? I have a really crude example, showing that it will work in the browser, but not in the standalone... I'll send it up on the server in a bit...just to share what I have found.

    If the preloader is part of the movie you then yt won't work, the SWF won't start playing until the entire file has been loaded into memory. If your preloaded does a loadMovie and loads an SWF into a target clip/level you can show a "loading" message, but I'm not 100% sure the player won't freeze up while it's loading the movie into the target clip/level.
    I have a shell that controls all loading and preloading, so the preloader is not in the individual swfs, but rather in a parent swf that is loading them into a target mc.. but good poing about my proposed solution, the flash player may freeze up all together while loading in the new content. I'll prolly have to experiment with that.

    Thanks, feel free to reply back.

  7. #7
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    heres a crude test. Made up of a shell that has 2 nasty buttons in the upper left that load swf 1 and 2 respectivly, and a next button in the upper right. as you can see if you drag the open_2.swf into a browser window you can still see the bytes loaded being calculated.

    since there is an upload file limit, you'll have to make two fat swfs to load in, call them 01.swf and 02.swf and place them in the same directory.

    Josh
    Attached Files Attached Files
    Last edited by sharey; 02-15-2006 at 10:09 PM.

  8. #8
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    I don't see anything when I drag the SWF into my browser window. I have to right click and select Play to see it do anything, but it doesn't load the 01.swf and 02.swf files I've placed in the same folder as open_02.swf

  9. #9
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    Im very sorry, it was looking for an xml file... Sorry about that.. give her another whirl.
    Attached Files Attached Files

  10. #10
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    I have 01.swf (16MB) and 02.swf (59MB) and they both load after a delay and I never see the number 100 change. One of the files has an internal preloader and it just flashes up for a frame and goes away (straight to 100% loaded).

  11. #11
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    The preloader is in the shell that i sent to you. You're draggin the file into a browser window? I get the percent loaded on mine.. I'll post a screenshot.

    Wait. i just checked it in IE and it doesnt show the loading progress as youre saying, however in firefox it does. both on PC. Interesting.
    Attached Images Attached Images

  12. #12
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The Flash plugin that's used by Firefox (npswf32.dll) actually opens a stream to read the local file and basically simulates what a web server would do (pass bytes to the plugin). That explains why it works in Firefox, it's the plugin doing all the work. Internet Explorer uses the flash OCX which handles local files differently so your preloaders won't work there.

  13. #13
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    That totally makes sense. So does the flash player typically freeze when you load local content into it? I'm sure I'll find out eventually, just wondering what your usual experience is.

    Great info. where did you find that.

    Josh

  14. #14
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The Flash player (OCX) seems to only have a single UI thread so it has to block while it's loading a large local file. The netscape/mozilla DLL won't block the same way the OCX will because it asks the container to provide the data in chunks, as it needs it. I've written a bit of code to use the npswf32.dll and had to figure out how it worked

  15. #15
    Senior Member
    Join Date
    May 2002
    Location
    Woodbury Minnesota, USA
    Posts
    371
    Sweet, thanks for your insite!

    bit
    Mwahh mwah hahahahahaahaha

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