A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: preloading sound from external SWF

  1. #1
    Aquaverse gdstudios's Avatar
    Join Date
    Mar 2002
    Location
    Washington, DC
    Posts
    1,789
    How do some people preload their background loops before the main movie begins? I have several swf's, one for the main page, each content page, and one for the sound loop. I have a preloader set up for the main movie, but I would like to have the main movie begin after preloading both the main movie and the music. Any suggestions?

  2. #2
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    Originally posted by gdstudios
    How do some people preload their background loops before the main movie begins? I have several swf's, one for the main page, each content page, and one for the sound loop. I have a preloader set up for the main movie, but I would like to have the main movie begin after preloading both the main movie and the music. Any suggestions?
    Like many people, I use the sound object and the attachSound command.

    I have my main.swf file and my sound.swf file.

    In the sound.swf, I only have my sound in the library. (this sound has a linkage name for actionscript)

    In the first frame of the sound.swf file, I use code like this:

    Code:
    createEmptyMovieClip("soundholder", 1);
    soundholder.mainsound = new Sound();
    soundholder.mainsound.attachSound("linkageName");
    This is MX code.

    If you loaded this sound.swf into your main.swf file, you would have to use code like this to control the sound:

    Code:
    _level2.soundholder.mainsound.setVolume(50);
    This just sets the volume of the sound.

    XFM

  3. #3
    Aquaverse gdstudios's Avatar
    Join Date
    Mar 2002
    Location
    Washington, DC
    Posts
    1,789
    Thanks Xurion, I will give this a shot later today. One more question. I would like to have a section of the main.swf that has a visible preloader while the sound.swf loads. Is this possible using your method, or does your method only mean that the main.swf will wait to begin until after the sound.swf has preloaded?

    Thanks again.

  4. #4
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    The best thing to do is to load the movie lets say into level 1. Then you would use this code in the main movie:

    Code:
    soundloaded = _level1.getBytesLoaded()
    soundtotal = _level1.getBytesTotal();
    percentage = Math.round(soundloaded / soundtotal * 100);
    This shows the bytes loaded of the movie in level 1.

    XFM

  5. #5
    Aquaverse gdstudios's Avatar
    Join Date
    Mar 2002
    Location
    Washington, DC
    Posts
    1,789
    As I am still polishing up my actionscripting, do you know of any examples for what you are suggesting I do? Any FLA's? Any tutorials? I hate to be a pain, but I really like when websites have this feature. Thanks again for the help.

  6. #6
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    I don't know of any at the moment. Why don't you try the sound forum on FK? Thats if you haven't already.

    XFM

  7. #7
    Aquaverse gdstudios's Avatar
    Join Date
    Mar 2002
    Location
    Washington, DC
    Posts
    1,789
    I have, but no response.

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