Sing linkage names to call upon sounds from another swf

I have two swf’s.
One main movie and one sound movie.
The sound movie exports the sounds,
providing linkage which i want to use in
an actionscript in the main movie.

How do i call upon the sounds from the second
movie? The reason why I have two files is that
Flash doesn’t allow me to choose in which frame
the sounds will be exported, it’s the first
frame or who-knows-when.

Would it be a good solution to load the
sound swf into the main movie, placing
it during the preload of this, and
export the sounds with linkage names
from this and (later) call upon them from
the main movie?

Is it possible at all?
If it is, how do I do it?

It’s pretty straightforward …

in this example the wav file has the linkage song, the swf containing the wav is called soundLibrary and the mainMovie is called mainMovie

  1. Export soundLibrary.swf as above

  2. Import the file to a level (not 0 this is the base level)

loadMovieNum (“soundLibrary.swf”, 1);

  1. Create a sound object that references the _level1 time line - i.e. tell mainMovie the path to your wav

music=new Sound(_level1)

  1. Attach and play as per usual


Don’t forget that you’need to ensure that soundLibrary.swf has loaded before calling it - you could use a conditional loop with getBytesLoaded/getBytesTotal.

You can also load into an instance of a MC with loadMovie - the process is the same and, again, you target the MC instance when you instantiate the sound object.

sounds logical… I must be missing something.
In the first frame of the preloader (which is told to
load every scene in the app before the intro starts):

loadMovieNum(“sounds.swf”, 1);

In the first frame of the main scene:

sound1 = new Sound(_level1);
sound2 = new Sound(_level1);
sound3 = new Sound(_level1);
sound4 = new Sound(_level1);
sound5 = new Sound(_level1);
sound6 = new Sound(_level1);
sound7 = new Sound(_level1);

(The linkage names are right, This worked
when the sounds were in the main library)

And, in another scene:

in 7 different frames with the numbers 1-7 after “sound”.

Should this work?

When you instantiate the sound Object i.e.
music = new Sound() you define the path -
music = new Sound (_level1)

When you call the sound object i.e. music.attachSound() and music.start() you call it from where it is (you’ve created it on _level0) so you don’t specify a level

And, in another scene:

should read

And, in another scene:

thank you, it’s working fine now…
phew, close one, deadline tomorrow =)