jeudi 22 janvier 2015

How to set the volume of audio player to a default 20% on my flash web page

I need to have my audio player start with a default 20% than 100%. I tried to deduct some digits in the related actionscript and all I did was set the entire bar to 20%... I even tried to pull the volume backward but that's not the way it works. (I'm not a coder btw.. I just play with codes to understand how they work)


I guess it has something to do with the actionscript below but in case that I'm wrong, I also attached the source .fla...





//
// SOUND CONTROL COMPONENT
//
// Initial Settings
//
originY = volBttn._y;
originX = volBttn._x;
maxX = scrollBar._width-volBttn._width;
eq_mc.gotoAndStop(Math.round(1+(_global.volumeAmount/20)));
hover_mc._visible = false;
// Equaliser
doEQ = function () {
eq_mc.eq_all._yscale = _global.volumeAmount;
};
resetSlider = function () {
volBttn._x = Math.round((scrollBar._width-volBttn._width)*(_global.volumeAmount/100));
};
// Volume button onPress
volBttn.onPress = function() {
this.startDrag(0, 0, originY, maxX, originY);
hover_mc.onEnterFrame = function() {
_global.volumeAmount = Math.round((volBttn._x/(scrollBar._width-volBttn._width))*100);
doEQ();
this.txt.text = _global.volumeAmount+"%";
this.txt._width = this.txt.textWidth+10;
this.bg._width = this.txt._width+10;
this._x = volBttn._x+volBttn._width/2;
this._y = volBttn._y;
hover_mc._visible = true;
};
};
// Volume button onRelease
volBttn.onRelease = volBttn.onReleaseOutside=function () {
delete hover_mc.onEnterFrame;
this.stopDrag();
hover_mc._visible = false;
this.gotoAndPlay('rollOut');
};
volBttn.onRollOver = function() {
this.gotoAndPlay('rollOver');
};



BTW I also can't increase or decrease the volume by clicking on the navigator bar. I have to click and hold that small navigator and then drag it to left or right. it makes it a bit difficult not to mention that there's no mute button. how may I fix it ?


http://ift.tt/1Jevs36


Aucun commentaire:

Enregistrer un commentaire