-
[F8] Panning sound problems
Hi guys, would really appreciate some help on this one.
Basically what im trying to do is pan a sound using _xmouse.
Now, ive been able to do this fine.. but the problem is that for some reason when its fully panned to the left or right speaker the sound gets very loud.. and seems to get louder then the original sound.
I have a feeling this is because its setting the pan value to -512 or +512 when the mouse is at the absolute left/right.
Ive uploaded the file here: http://www.megaupload.com/?d=N3GP92G4
My question is; How can i get this to work properly without the sound increasing?
Last edited by itzsess; 07-17-2007 at 02:27 PM.
-
Senior Member
Could you just post the code here?
-
Yeh no worries
fireplace = new Sound();
fireplace.attachSound("fireloop");
fireplace.start("", 9999);
onClipEvent (enterFrame) {
pan = _root._xmouse-512;
_parent.fireplace.setPan(pan);
}
Movie is 1024 in width.
-
Senior Member
The setPan method only accepts values between -100 (pan left) and 100 (pan right). Anything else will mostlikely produce unwanted results, such as you're getting.
Try this:
Code:
onClipEvent (enterFrame) {
var midPoint:Number = Stage.width/2;
pan = Math.round((_root._xmouse - midPoint)/midPoint*100);
_parent.fireplace.setPan(pan);
}
It places the midPoint at the center of the Stage and adjusts the pan according to the percentage the cusrsor is away from the center point.
_t
-
Thanks mate! works perfectly and seems to of cleared up the crackles id get as well.
REALLY appreciate it haha, this has been really bugging me for a while now!
Im just not that crash hot at actionscripting
-
Just one more question mate :P
This seems to be effecting all sounds in the flash file. No matter what way i import the other sound objects they also seem to get effected by the coding.
Ive changed the linkage to the main file i want panned (fire sound) and given it the identified name of "fireloop". But even after doing that all other sounds get effected.
Any way i can fix this?
Code:
//fireplace
fireplace = new Sound();
fireplace.attachSound("fireplacemp3");
fireplace.start("", 999);
//music
music = new Sound();
music.attachSound("Latino_L-Beyonda-11684wav");
music.start("", 999);
Last edited by itzsess; 07-18-2007 at 12:06 PM.
-
nevermind, worked it out
//fireplace
fireplace = new Sound(fireloopMC);
fireplace.attachSound("fireplacemp3");
fireplace.start("", 999);
//music
music = new Sound();
music.attachSound("Latino_L-Beyonda-11684wav");
music.start("", 999);
cheers
Last edited by itzsess; 07-18-2007 at 12:37 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|