# Issues with Multiple Sounds

**URL:** <https://forum.kirupa.com/t/issues-with-multiple-sounds/218960>\
**Category:** flash\
**Created:** [March 12, 2007, 8:14pm UTC](https://forum.kirupa.com/t/issues-with-multiple-sounds/218960 "2007-03-12T20:14:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronjon](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@Ronjon](https://forum.kirupa.com/u/Ronjon)\
**Post date:** [March 12, 2007, 8:14pm UTC](https://forum.kirupa.com/t/issues-with-multiple-sounds/218960/1 "2007-03-12T20:14:05Z")

</div>

Hi There,

I’m working on a project in which sound plays an important part.  
I want to be able to adjust the volume of two sounds independently, ánd have access to the position in the soundfile.

The code below plays 2 soundfiles (“L36 Bass.wav” & “L36 Perc.wav”). The sounds are declared as ‘new Sound’ with qualifiers  
(“L36Bass” and “L36Perc” recpectively) in line 03 & 04 within empty movieclips, to allow individual volume-adjustments.

The volume-mix between the 2 is then governed by the x-mouse position (line 10 - 16):

01 this.createEmptyMovieClip(“L36Bass”, 1)  
02 this.createEmptyMovieClip(“L36Perc”, 2)  
03 SndBass = new Sound(“L36Bass”)  
04 SndPerc = new Sound(“L36Perc”);  
05 SndBass.attachSound(“L36 Bass.wav”);  
06 SndPerc.attachSound(“L36 Perc.wav”);  
07 SndBass.start()  
08 SndPerc.start();

09 this.onEnterFrame = function ()  
10 { onMouseMove = function ()  
11 { xf = \_root.\_xmouse / Stage.width;  
12 if ( xf \> 0.5 )  
13 { volBass = 100; volPerc = 200 \* ( 1 - xf ) }  
14 else  
15 { volPerc = 100; volBass = 200 \* xf }  
16 SndBass.setVolume(vBass); SndPerc.setVolume(vPerc);  
17 }

18 SndBass.onSoundComplete = function()  
19 { SndBass.start(); SndPerc.start(); }  
20 }

This works just fine (as long as the WAV-files are in the library and the option ‘Export for Actionscript’ is selected).  
However, when I try to access the position within a soundfile with the statement

SndBass.position;

this results in an ‘undefined-error’.  
When I remove the qualifier in line 03, and go for ‘SndBass = new Sound()’ in stead of ‘SndBass = new Sound(“L36Bass”)’, the property SndBass.position is available, but, as expected, the individual volume-control is lost.

Any suggestons?
