A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Preloader resuming problems

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    11

    Question Preloader resuming problems

    Hello,
    I created a swf which loads multiple external swfs to 100% before playing. Which works fine. If I stop a clip while it's loading, I call loader.close() and I'm able to resume from where I left off at a later time.

    The problem I'm having is when I added the functionality to load the next clip while the current clip is playing. To be clear, I'll refer to the normal preloader as preloader, and the preloader which loads the next clip as pre-preloader. If the pre-preloader loads to 100%, everything is good. The next clip will play immediately without having to wait. If, however, the pre-preloader for the next clip is stopped at any point before 100%, the preloader will start loading at 0%.

    With that being said, If I go back to the previous clip (which was previously already playing), the pre-preloader will pick back up where it left off, then if I go forward again, the preloader will pick up where IT left off.

    The reason this seems so strange to me is that it's a new instance of the Loader class every time it starts or resumes loading, so why will the preloader only resume it's own stuff, and the pre-preloader will only resume it's own stuff?

    I thought it might have had to do with the fact that I was using a variable called "loader" for the preloader, and "preloader" for the pre-preloader. I was wrong. I made an array to hold the loader for each clip and now the preloader and pre-preloader use the same index of that array when preloading the swfs. I get the exact same result.

    If necessary, I can provide some code, but it will take a little time as I would have to cut it down from 1500 lines to something a little less cumbersome to read through (without cutting out anything relevant to my issue).

    I hope I've not worded any of that in too confusing a manner. It's not "broken", it's not acting as intended and it's an annoying quirk that I don't understand. Thanks in advance for any tips or help pointing me in the right direction.

    -Scott

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    When an object is not loaded 100%, it is simply not loaded and the loading will start from 0. There is no half loading.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    Understood, but that just leaves me with more questions.

    If I start preloading 1 clip, close the loader, start loading another clip, then go back to preloading the 1st clip, it resumes where it left off preloading. It does resume. How does that happen if it's an 'all or nothing' situation? Every time close the loader, I set the variable to null, so I'm using a new instance every time I start loading.

  4. #4
    Junior Member
    Join Date
    Jan 2009
    Posts
    11
    I (kind of) fixed my issue by not destroying the pre-preloader's Loader instance. Instead, I pass the reference to the regular preloader without closing it and use a boolean variable to let my event handlers know whether they should be dispatching the events or keeping the preloading quiet.

    One quirk this causes (but hopefully won't be a big issue) is:
    If I load clip 1 to 100% and start playing it, then pre-preload clip 2 to 75% before clip 1 is done, the preloader continues to load from 75%, but if I click "back" before it's done, It'll start pre-preloading clip 2 all over (as expected based on the "no partial loading" explained above by cancerinform).

    However, if when clip 2 gets to 90% I navigate to any other clip or series of clips and then go back to clip 2, it will resume preloading at 90%. Which is why I'm still curious what the reason is that I'm able to take advantage of resuming from a partial preload if the functionality doesn't exist. I no longer have an issue, but if someone could explain that to me so I understand better, that'd be awesome. Thanks!

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