PDA

View Full Version : reset sound position


toke
09-02-2003, 04:59 PM
how do reset the sound position to start from 0 again after the movie finished loading? here is the script I use:

on the main movie


_global.mSound = new Sound(this);
this.onEnterFrame=function(){
_global.mSoundDuration = _global.mSound.duration/1000;
_global.mSoundPosition = _global.mSound.position/1000;
mD.text=_global.mSoundDuration;
mP.text=_global.mSoundPosition;
}

mSound.attachSound("test2");
mSound.start(0,999);
mSound.setVolume(10);


on the last frame of the main movie, i load another movie on level 0
loadMovieNum("movie2.swf",0);

on "movie2.swf" first frame, I have

this.onEnterFrame=function(){
_global.mSoundDuration = _global.mSound.duration/1000;
_global.mSoundPosition = _global.mSound.position/1000;
mD.text=_global.mSoundDuration;
mP.text=_global.mSoundPosition;

}



if(_global.mSoundPosition < _global.mSoundDuration){
_global.mSound.start(_global.mSoundPosition,999);
trace(_global.mSoundPosition);
}else{
trace(_global.mSoundPosition);
_global.mSoundPosition = 0;
_global.mSound.start(_global.mSoundPosition,999);
}

but the audio will start at whatever position I left the main movie. It won't reset itself to 0. how can I do that?

farafiro
09-03-2003, 06:35 AM
for this line
_global.mSound.start(_global.mSoundPosition,999);

toke
09-03-2003, 12:47 PM
Hi Farafiro... sorry but I don't get it.. what am I supposed to do with this?

for this line
_global.mSound.start(_global.mSoundPosition,999);

toke
09-03-2003, 12:49 PM
wait.. do you mean just replace the scripts on movie2.swf with only this line?

for this line
_global.mSound.start(_global.mSoundPosition,999);

toke
09-03-2003, 06:31 PM
still having the same problem :(

farafiro
09-04-2003, 02:56 AM
thisif(_global.mSoundPosition < _global.mSoundDuration){
_global.mSound.start(_global.mSoundPosition,999);
trace(_global.mSoundPosition);
}means that if the current position is less than the duration, let the music starts from the this position, just make it starts from the position 0

toke
09-05-2003, 01:22 PM
ok. thank you farafiro. :)

thephpguru
03-12-2010, 04:51 PM
how do reset the sound position to start from 0 again after the movie finished loading? here is the script I use:

on the main movie


_global.mSound = new Sound(this);
this.onEnterFrame=function(){
_global.mSoundDuration = _global.mSound.duration/1000;
_global.mSoundPosition = _global.mSound.position/1000;
mD.text=_global.mSoundDuration;
mP.text=_global.mSoundPosition;
}

mSound.attachSound("test2");
mSound.start(0,999);
mSound.setVolume(10);


on the last frame of the main movie, i load another movie on level 0
loadMovieNum("movie2.swf",0);

on "movie2.swf" first frame, I have

this.onEnterFrame=function(){
_global.mSoundDuration = _global.mSound.duration/1000;
_global.mSoundPosition = _global.mSound.position/1000;
mD.text=_global.mSoundDuration;
mP.text=_global.mSoundPosition;

}



if(_global.mSoundPosition < _global.mSoundDuration){
_global.mSound.start(_global.mSoundPosition,999);
trace(_global.mSoundPosition);
}else{
trace(_global.mSoundPosition);
_global.mSoundPosition = 0;
_global.mSound.start(_global.mSoundPosition,999);
}

but the audio will start at whatever position I left the main movie. It won't reset itself to 0. how can I do that?
if you put the start command above loadsound function position will reset even if loadsound is in a parent loop.

for(var songNum = 0; songNum <= 10; songNum++){
trace(songNum);
mySound.start(0,999);
mySound.loadSound("http://thewordsmith.info?songNum=" + songNum,true);
}

I did this on http://www.thewordsmith.info/

toke
03-13-2010, 05:56 PM
Thanks.