# Sing linkage names to call upon sounds from another swf

**URL:** <https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087>\
**Category:** Uncategorized\
**Created:** [September 29, 2002, 10:13am UTC](https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087 "2002-09-29T10:13:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leuchovius](https://avatars.discourse-cdn.com/v4/letter/l/2acd7d/32.png) [@leuchovius](https://forum.kirupa.com/u/leuchovius)\
**Post date:** [September 29, 2002, 10:13am UTC](https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087/1 "2002-09-29T10:13:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2002, 8:45am UTC](https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087/2 "2002-09-30T08:45:47Z")

</div>

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

music.attachSound(“song”)  
music.start()

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2002, 10:33am UTC](https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087/3 "2002-09-30T10:33:29Z")

</div>

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);  
sound1.attachSound(“galleri1”);  
sound2 = new Sound(\_level1);  
sound2.attachSound(“galleri2”);  
sound3 = new Sound(\_level1);  
sound3.attachSound(“galleri3”);  
sound4 = new Sound(\_level1);  
sound4.attachSound(“galleri4”);  
sound5 = new Sound(\_level1);  
sound5.attachSound(“galleri5”);  
sound6 = new Sound(\_level1);  
sound6.attachSound(“galleri6”);  
sound7 = new Sound(\_level1);  
sound7.attachSound(“galleri7”);

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

And, in another scene:  
\_level1.sound2.start();

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

Should this work?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2002, 11:46am UTC](https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087/4 "2002-09-30T11:46:58Z")

</div>

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:  
\_level1.sound2.start();

should read

And, in another scene:  
sound2.start();

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2002, 3:50pm UTC](https://forum.kirupa.com/t/sing-linkage-names-to-call-upon-sounds-from-another-swf/6087/5 "2002-09-30T15:50:14Z")

</div>

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