Action Script for volume control

Hi all.

Ok i have developed an XML mp3 player as part of an assignment i have due in tomorrow. I have everything working fine apart from the volume control.

We have only been taught how to do sound on and sound off. However i would really like to do a scrolling volume control. Bit like a cross fader which i have in place.

i managed to get some actionscript in order to do this but it confused me a little due to the use of _parent refering to sound_mc and sound_obj. I am starting to understand more and believe that the way my whole player has been designed means i cant have this kind of volume control. Is this correct??

Here is the code for my entire player, the volume control code is towards the bottom but obviously doesnt work. The vertFader, fade_bg and fader_btn are each variables that i currently have on stage.

Any help is very much appreicated.


var mp3:XML = new XML();
mp3.ignoreWhite = true;
var songArray:Array = new Array();
var urls:Array = new Array();
var titles:Array = new Array();
var currentIndex:Number = 0;

var player:Sound = new Sound();


mp3.onLoad = function(success){
    
    if (success) 
    {
        songArray = mp3.firstChild.childNodes;
        for(i=0;i<songArray.length;i++) {
            urls.push(songArray*.attributes.url);
            titles.push(songArray*.attributes.title);
            
        }
        player.loadSound(urls[currentIndex],true);
        title_txt.text = titles[currentIndex];
        
    }
    else 
    {
        title_txt.text = "The MP3 player is currently out of order. Please try again later.";
    }
}

mp3.load("mp3s1.xml");



//-----CONTROLS------//

var currentPosition:Number = 0;
var paused:Boolean = false;

stop_btn.onRelease = function(){
    
    currentPosition = 0;
    player.stop();
    paused = true;
}

play_btn.onRelease = function(){
    
    if(paused){
    player.start(currentPosition);
    paused = false;
    
    }
}

pause_btn.onRelease = function(){
    
    if(!paused){
    currentPosition = player.position/1000;
    player.stop();
    paused = true;
    
    }
    else
    {
        if(currentPosition > 0){
        player.start(currentPosition);
        paused = false;
        }
    }
}


//-----Next & previous buttons-----//

function nextSong(){
    
    if(songArray[currentIndex +1]){
        
        currentIndex++;
    }
    else{
        
        currentIndex = 0;
    }
    player.loadSound(urls[currentIndex],true);
    title_txt.text = titles[currentIndex];
    
    
}

function prevSong(){
    
    if(currentIndex > 0){
        
        currentIndex --;
    }
    else
    {
        currentIndex = songArray.length -1;
    }
    player.loadSound(urls[currentIndex],true);
    title_txt.text = titles[currentIndex];
    
}



next_btn.onRelease = nextSong;

bck_btn.onRelease = prevSong;






//------Volume Control------//

this._parent.fader_btn.vertFader.onPress = function(){
startDrag(this,
true,0,this._y,this._parent.fade_bg._width,this._y);
}

this.onEnterFrame = function () {
var g = (this._x/this._parent.fade_bg._width)*100;
this._parent._parent.sound_mc.sound_obj.setVolume(g);
}
this._parent.fader_btn.vertFader.onRelease = function(){
    delete this.onEnterFrame
stopDrag();

}
this._parent.fader_btn.vertFader.onReleaseOutside = function() {
stopDrag();
}


//---------Scrolling Text-------------//

this.onEnterFrame = function() {
    if (title_txt.hscroll<title_txt.maxhscroll) {
        title_txt.hscroll += 2;
    } else if (title_txt.hscroll == title_txt.maxhscroll) {
        title_txt.hscroll = 1;
    }
};
stop();