dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: preload .swf?

  1. #1
    Member
    Join Date
    Nov 2011
    Posts
    34

    preload .swf?

    So, I'm now working on one project that has numerous embedded .swfs.

    For the first three animations, I created empty movie objects, and loaded the movie as a series of jpgs for each frame, thus, the main movie .swf actually contains the animation, so it pre-loads, and shows the user the loading process.

    Now, as you advance through the animation, the problem is when you get through the animations that are pre-loaded, and continue with the non-pre-loaded .swfs (the ones that are merely referenced).

    As a first-time user, when you get to them, you see the "loading" bar. However, I don't want my users to see that, I want to "preload" those .swfs in the first frame, or have the very first button preload the external .swfs.

    I can't figure out how to do that though. When I use the actionscript "LoadMovie", it actually plays the movie, which is not what I want.

    Here's the link to my latest version:
    http://www.brianheagney.com/Q-Matic/...reload_02b.swf

    Any thoughts would be great...I'm almost finished I think!
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Nov 2011
    Posts
    34
    And here's a link to a .zip folder with most of everything I hope:
    www.brianheagney.com/Q-Matic/QM-HC-Final/NoPreloader.zip

  3. #3
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    A preloader is a small piece of code running in the first frames of a movie that stays there until the load is completed and continues with the rest of the movie when everything is loaded.
    What might be possible in your case is to put a stop action in your external movies so they don't play everything and use actionscript to let the main movie communicate with them and tell them to continue playing.
    Another option (if you are using ActionScript 3) would be to load a movie as a byte array at first and load it from that array once you need it.

  4. #4
    Member
    Join Date
    Nov 2011
    Posts
    34
    Thanks again for the lead, w.brants...unfortunately, as you've already noticed no doubt, I can't find a single working example on how to do what you suggest above, and when I try to write it out based on the numerous other suggestions I've found.

    I've seen this same question all over the web and on other forums, and so far, I've only seen the answer presented in theory, which is fine, but when it doesn't work for me after many hours, I start to go crazy and want to break everything in my studio.

    I hope to solve this, and when I do, I will definitely post the files and the actual solution!

  5. #5
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    You could try the MovieClipLoader class.
    Using that class you can assign an onLoadComplete function that is executed when the load has finished.
    The problem with a lot of code you will find on the internet is that ActionScript 1 is very old. A lot of examples are AS 2 (not supported by KM) or AS3.

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