volume control in flash
I have a banner in flash. One big movie clip with lots of layers. On one layer I've dropped my sound, added a volume control that works perfectly. Before I added the volume control, once my banner was finished, so was the melody. Now it loops and loops(just the melody). Is there any kind of coding to make my melody stop once the banner is over开发者_如何学C(not with an stop btn). This is my code for the volume and melody:
var left:Number = controller_mc._x-100;
var right:Number = controller_mc._x;
var top:Number = controller_mc._y;
var bottom:Number = controller_mc._y;
_root.vol = 100;
mysound = new Sound();
mysound.attachSound("entertainerloop.wav");
mysound.start();
controller_mc.onPress = function()
{
startDrag("controller_mc",false,left,top,right,bottom);
dragging = true;
controller_mc.text_mc._visible = true;
}
controller_mc.onRelease
controller_mc.onReleaseOutside = function()
{
stopDrag();
dragging = false;
controller_mc.text_mc._visible = false;
}
controller_mc.onEnterFrame = function()
{
if(dragging)
{
var level = 100 + ( controller_mc._x - right);
_root.vol = Math.round(level);
if(_root.vol > 75)
{
_root.volume_mc.gotoAndStop(1)
}
if(_root.vol < 75)
{
_root.volume_mc.gotoAndStop(2)
}
if(_root.vol < 50)
{
_root.volume_mc.gotoAndStop(3)
}
if(_root.vol == 0)
{
_root.volume_mc.gotoAndStop(4)
}
mysound.setVolume(_root.vol)
}
mysound.onSoundComplete = function()
{
mysound.start();
}
}
Just remove this (towards the end of your script):
mysound.onSoundComplete = function() { mysound.start(); }
精彩评论