PDA

View Full Version : Importing sounds from external SWF



Nosaj
December 2nd, 2005, 04:05 PM
Hey people,

I know this subject has been spoken upon alot and tutorials provided such as
http://kennybellew.cowfly.com/tutorial/preload_attachsound.htm

but I still somehow cant get it to work! I've spent hours surfing around and trying to fix it but I guess I've reached a dead end. This is how my .fla files are.

One contains the sound. The .fla is called Track2.fla.
In it, I've imported a .wav file and set the Linkage to export for AS and export in first frame. The identifier is "Track2".

on the first frame of the timeline, I added this code:
trackMusic = new Sound(this);
trackMusic.attachSound("Track2");

========

For the second .fla, it is called Test.fla. I created the empty movie clips such as the tutorial has suggested and placed this codes in the first frame:

_root.soundHolder.loadMovie("Track2.swf");
_root.soundHolder.trackMusic.start();

No sound at all.
The funny thing is when i placed trackMusic.start() in Track2.fla it works perfectly.

Also I have tried the following and have yet to succeed :

var BackgroundMusic:sound = new Sound(2);
loadMovie("Track2.swf", 2);
BackgroundMusic.attachSound("Track2");
BackgroundMusic.start();

rhamej
December 3rd, 2005, 03:18 PM
You need to make sure the swf has completely loaded before you tell it start. Other wise you are telling nothing to start(). Build a preloader or use prelaoder code to see if its loaded first :)

Nosaj
December 4th, 2005, 04:21 AM
Thx for the quick reply. I will try it asap. Rewriting part of the script. Will show you the end result when its done ^^.