all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

I have created a stop button to stop a audio file


I have created a stop button to stop a audio file shallowdeep
10/26/2006 9:19:51 PM
flash actionscript: This is the action script that I have created

musicbutt.onRollOver=function(){
musicmc._visible = true;
musicmc.gotoAndPlay(1);
if(!musicmc.alreadyPlayed){ // use a movieclip button
musicmc.alreadyPlayed=1;
this.s=new Sound(yoda);
this.s.attachSound("yoda"); // create a linkage id for the library sound
associated with this button
this.s.start();
}
}

I also have a button called stopbuttbutton. I want this stop button to stop
the audio file yoda. However being new to actionscript I aint sure what
actionscript I require.
Re: I have created a stop button to stop a audio file Darr_darshan
10/27/2006 6:25:55 AM
hi
this.s.stop()
this can be used to stop sound
you can get position by
a = this.s.position //this will be in milliseconds
then restart by

this..s.start(a)
is used to start sound from paticular position


Re: I have created a stop button to stop a audio file Ankur Arora
10/27/2006 9:55:01 AM
// Code Must be On Timeline




var mySound:Sound = new Sound(this);
var startPosition:Number = 0;
//start_btn is the instance name of the Start Sound Button
start_btn.onRelease = function() {
mySound.attachSound("yoda");
mySound.start(startPosition);
};
// if you are having pause functionality in your application
//pause_btn is the instance name of Pause Button
pause_btn.onRelease = function() {
startPosition = mySound.position;
mySound.stop();
};

//stop_btn is the instance name of the Stop Sound Button
stop_btn.onRelease = function() {
startPosition = 0;
mySound.stop();
};
AddThis Social Bookmark Button