PDA

View Full Version : loading external sound objects


j-man
11-23-2001, 02:08 AM
not really sure if this belongs in the newbie section...Ok, here's the deal. Im creating a "mixer" that uses sliders to change the volume and pan of multiple tracks.... Everything works when I have a sound in the main movie's library and create a sound object using it's linkage.... I'd like to have all of my sounds in external data.swfs so that i can swap in new sounds without having to modify script in the main movie....but i'm having a little bit of trouble getting the external sound objects to load.

The structure of my setup is as follows:

data.fla - this is the fla that contains the data sound. The linkage is specified as soundID the actionscript found in this movie is as follows:
mySound = new Sound(this);
mySound.attachSound("soundID"_;

data.swf - the exported movie containng the mySound sound object.

player.fla - the main movie, On the main timeline an there is an instance of controlMC to which the sound objects are attached

now for my question, how do i load that sound object into my controlMC clip? my first thought would be something along the lines of (scripted in controlMC)
loadMovieNum ("data.swf", 0);
mySound.start(0,999);

but apparently that isnt exactly the right approach.
if(anyone can help) { i'd appreciate it}

thanx - j-man

Jeremy Severson
11-27-2001, 06:21 PM
I had this same problem with music. this is what i got to work,

data.swf
==========
s = new Sound(target MC);
s.setVolume(100);
s.start();
stop ();


instead of attaching the sound though i made a movie 1 frame long and put the above code on it and then put a movie clip of the sound i want that is one frame long with a stop command on it and i set it to loop 10,000 times. Then i put some graphic in the MC just so i could see it. The only problem with this is you can't use the s.start(); or s.stop(); commands because you are not attaching a sound.

player.swf
===========
loadMovie ("data.swf", 2, "POST");

So now it will load your sound into _level2 or your movie. If you want to stop it you could use

unloadMovie(_level2);

but you have to make sure there is nothing else in _level2 because that will be unloaded also. If this doesn't work let me know.

Jeremy Severson
11-27-2001, 06:22 PM
sorry i noticed a mistake, but below is correct for data.swf now,

data.swf
==========
s = new Sound(target MC);
s.setVolume(100);
s.start();
stop ();

Jeremy Severson
11-27-2001, 06:23 PM
sorry once again, i am positive this time

data.swf
==========
s = new Sound(_level2);
s.setVolume(100);
s.start();
stop ();