PDA

View Full Version : Controlling the volume and sound playback of loaded fla's


suspect27
12-31-2005, 10:15 AM
My main Fla is a small file with a holder movie clip that uses loadMovie(); to call in external Fla files. Each of these Fla files represents a music track and has said track embedded as a part of it. Is there any way whatsoever to controll the sound volume and play back of these loaded Fla files from within the main Fla file thats loading them?

LostInRecursion
12-31-2005, 12:40 PM
A little more detail, suspect. In the FLAs which contain the sounds, are you using a Sound Object to control the sound? Meaning is there anywhere in the code that looks like this:


var mySound:Sound = new Sound();
mySound.attachSound("myLinkageID");
mySound.start(0,0);


If so, you can use the Sound classes nifty setVolume method to accomplish your goal. Syntax for that, based on the above code, would be:


mySound.setVolume([0-100]);
//Replace [0-100] with a number where 0 equals mute and 100 equals full vol.


If you are using another method, let me know.

suspect27
12-31-2005, 08:19 PM
No Im not using mysound in any of the external Fla's that have the actual sounds in them. The sound is just dropped into a layer on the stage in each track Fla. If I were to be required to go back and do the sound by declaring it with action script, what would be the process, and is that nessecary?

suspect27
01-01-2006, 05:43 AM
Okay, well I've decided to go an entirely different route with this and simply control playback and volume from within the track Fla's. I have everything working precisely as I want it to now with one exception, the preloader.

This is the code for playing the sound:

bgSound = new Sound(this);
bgSound.attachSound("song");
bgSound.start(0, 0);
playB.enabled=false;

slider.slideBar._x = 75;
slider.slideBar.onEnterFrame = function() {
bgSound.setVolume(0-this._x);
};
slider.slideBar.onPress = function() {
startDrag(this, false, 2.5, this._y, 97.5, this._y);
};
slider.slideBar.onRelease = slider.slideBar.onReleaseOutside=function () {
stopDrag();
};
stopB.onRelease = function() {
bgSound.stop();
playB.enabled=true;
stopB.enabled=false;
gotoAndStop(1);
};
stop();

Because I have to use linkage in order to attatch the sound, that means I have to have the "export in first frame" option selected, and when it is, my preloader doesnt show up at all...what gives?

LostInRecursion
01-02-2006, 09:42 AM
Easy fix on that one. Just go into your "Publish Settings" choose Actionscript 2.0 settings and you'll see the "Export Classes in Frame" box. Choose another frame other than 1.

Then just make sure you're not calling the sound before you have passed that frame.

suspect27
01-04-2006, 12:33 AM
Okay I did that but its not working, and I'm assuming thats because this isn't set up as a class maybe? I have no knowledge as far as classes are concerned. What do I need to adjust about how the sound is called or the linkage in order for this to have any effect, because it seems to make sense I'm just missing one part of it to make it work.

suspect27
01-04-2006, 12:42 AM
Okay after learning a bit about what classes are, and seeing that Sound is a class, I get what this is doing now, but it's not working. I set it to export sound into frame 5.

The way my flash is set up is that it has 2 scenes. Scene 1 is the preloader and is your standard preloader fare 5 frames long. The sound begins in frame 1 of the second scene. I don't get why this isn't working.

So if anyone can figure out what to do it'd be greatly appreciated.

suspect27
01-04-2006, 06:43 PM
Anyone? ;p