• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Action Script

deamer44

Guest
May 25, 2008
168
0
0
Hello once again, i'm having trouble with my ict project. Im trying to implement a menu system that allows me to play sound, however at the current moment as soon as i preview the movie the sound starts, im wondering if i can make the sound start when i click on the button?

The current action script is as follows:
soundObj = new Sound();//Create a sound object
soundObj.attachSound("Sound");//Attach our sound from the libary
soundObj.isPlaying = false;//set the playing var to false
//play button
_root.playBt.onRelease = function(){//when the play button is released
if(soundObj.isPlaying == false){//if the sound isn't already playing
_root.soundObj.start(0,99);//play the sound from the start and loop it 99 times
soundObj.isPlaying = true;//the sound is now playing, change the var to reflect this
}
}
//stop button
_root.stopBt.onRelease = function(){//when the stop button is clicked
_root.soundObj.stop();//stop the sound
soundObj.isPlaying = false;//set the isplaying var to false
}
 

wwswimming

Banned
Jan 21, 2006
3,695
1
0
is that Actionscript 2.0 ?

i'm taking a class in Flash AS 3.0. i hear good things about older versions of AS,
namely that it made it easier to do a lot of things.