A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loading music separately

  1. #1
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57

    Loading music separately

    I currently have a music file that is being imported from an external SWF file. The problem is, the music takes forever to load (it's about 3 megabytes) and I don't want the users to have to wait for it to load before they can view the content of the scene.

    How can I load the scene minus the music first, and then load the music second?

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    this all depends upon how you have your movie set up.

    assuming you want to load all frames in scene 1 before loading a sound, one approach would be to set up an ifFrameLoaded() timeline loop before scene 1 contents. Once flash loads all frames in the scene then load the sound as an external SWF in another level.

    Code:
    // frame 1
    ifFrameLoaded(last frame  number of scene){ // scene loaded
       loadMovieNum("urlto.swf",1); // start loading sound
       gotoAndPlay(3); // jump out of loop
    }
    
    // frame 2
    gotoAndPlay(1); // loop back until scene loaded
    frame 3 is actual start of scene 1.

    You may also be able to use a label as the condition for ifFrameLoaded() which would be more flexible than a frame number incase you add more frames to the scene later. You might also put the ifFrameLoaded loop as the first scene in your timeline as a "preloaded" scene, just to be consistent with your movie strcture.

  3. #3
    Member
    Join Date
    Apr 2004
    Location
    IA, USA
    Posts
    57
    Thanks, I think I understand most of that; I'll jot it down for next time.

    I did some more hunting around and I found this excellent tutorial, which helped me do everything I wanted to do and more.

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