-
volume slider code.
On (Press) ;
/:mute=0;
set Property("_root.audioBar.bar",_alpha,65);
startDrag("_root.audioBar.bar",true,0,0,0,117);
if (_ymouse<=116.7);{
/:mousey=_ymouse;
setProperty("_root.audioBar.bar",_y, /:mousey);
} else {
set Property("_root.audioBar.bar",_y,116.7);
/:mousey=116.7;
}
/volume=(((116.7-/:mousey)/116.7)*100);
_root.song.setVolume(/:volume);
My question is at the volume part. I dun understand why i have to divide by 116.7 again and then mutiply by 100.
-
That is because it is calculating the percentage that the slider has moved - this is a number between 0 and 1 (eg. 0.54334).
Setvolume needs a number from 0 to 100, so you multiply the percentage by 100 to get the right value (eg. 54.334).
- n.
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
|