maximusprime
01-24-2003, 10:36 PM
ok guys, this should be pretty easy.
i have a sound.swf file with the following functions:
function startSound(){
mysoundobj=new Sound(this)
mysoundobj.attachSound("feelGood")
mysoundobj.start()
}
function stopSound(){
mysoundobj.attachSound("feelGood")
mysoundobj.stop()
}
where feelGood is the linkage export id of the sound.
now, i have a simple main movie with 2 buttons, stop and play. when you hit play, it forwards to frame 2, which contains a movie symbol, with the following scripting:
onClipEvent(load){
loadMovieNum("sound.swf",1)
}
var initialized
onClipEvent(enterFrame){
percentloaded=Math.floor(_level1.getBytesLoaded()/_level1.getBytesTotal()*100)
if(percentloaded == 100 && !initialized){
_level1.startSound()
initialized=true
_visible=false
}
}
this starts the load process, and the sound downloads. when it reaches 100 percent, it starts playing and the load animation is set to invisible, so the song name located underneath is shown.
The stop button has the following code:
on(release){
_level1.stopSound()
_root.gotoAndPlay(1)
}
so it invokes the stopsound method and goes back to frame one.
the problem, as some of you will have spotted already, is that to prevent the song from starting playing every time the song name animation loops, i had to add an "initialize" variable, so it only starts play once. however, this variable remains true even after the stop button is hit. my question is, when the stop button is hit, how do i set the initalization back to false? im not too familiar, with aS syntax, but i assume it is something simple like (clipname).initialize=false or something like that, but i cant get it working.
suggestions?
i have a sound.swf file with the following functions:
function startSound(){
mysoundobj=new Sound(this)
mysoundobj.attachSound("feelGood")
mysoundobj.start()
}
function stopSound(){
mysoundobj.attachSound("feelGood")
mysoundobj.stop()
}
where feelGood is the linkage export id of the sound.
now, i have a simple main movie with 2 buttons, stop and play. when you hit play, it forwards to frame 2, which contains a movie symbol, with the following scripting:
onClipEvent(load){
loadMovieNum("sound.swf",1)
}
var initialized
onClipEvent(enterFrame){
percentloaded=Math.floor(_level1.getBytesLoaded()/_level1.getBytesTotal()*100)
if(percentloaded == 100 && !initialized){
_level1.startSound()
initialized=true
_visible=false
}
}
this starts the load process, and the sound downloads. when it reaches 100 percent, it starts playing and the load animation is set to invisible, so the song name located underneath is shown.
The stop button has the following code:
on(release){
_level1.stopSound()
_root.gotoAndPlay(1)
}
so it invokes the stopsound method and goes back to frame one.
the problem, as some of you will have spotted already, is that to prevent the song from starting playing every time the song name animation loops, i had to add an "initialize" variable, so it only starts play once. however, this variable remains true even after the stop button is hit. my question is, when the stop button is hit, how do i set the initalization back to false? im not too familiar, with aS syntax, but i assume it is something simple like (clipname).initialize=false or something like that, but i cant get it working.
suggestions?