gotoAndPlay

I’m making a movie where there is an mp3 playing throughout the duration. I want Flash at a certain time point in the movie to 'gotoAndPlay" an animation. except so far it just goes right to the animation, not when the mp3 has started on my click of the button. I have attached the AS thus far, any ideas?

on(press){
firstSound=new Sound();
firstSound.attachSound(“VanHalen”);
if (playing!=true) {
_root.firstSound.start(0,1);
playing=true;
}
this.onEnterFrame = function (){
if (mySound.position >= 10) {
_root.gotoAndPlay(26)
}
}
}

Thanks!

Did you mean:
if (firstSound.position >= 10) {
_root.gotoAndPlay(26)
}
}

I think you targeted the wrong object there in the if statement. But I dont think changing that would fix it…maybe im wrong.

You wre right. mySound should have been firstSound. However, I can’t figure out how I need to set things up so that the animation dosen’t happen until the sound is at the certain time. It seems like my timeline is just playing through(?). Is there a way to not have anything in the timeline start until i “on (press” the start button?

Thanks for you help.

hey dkzete, the trace function helps out a lot when debugging things. I just tested out the sound.position code and it seems that .position tracks the sound in milliseconds. So instead of:
if (firstSound.position >= 10), try:
if (firstSound.position >= 10000), or if (firstSound.position/10 >= 10)