PDA

View Full Version : gotoAndPlay question


UIDesigner
12-21-2008, 11:00 PM
Howdy, and thanks in advance for viewing this.

My Flash CS3/Actionscript 3 animation is a five-chapter animation, each chapter an independent movie clip, all of them simply placed sequentially on the timeline. Each movie clip has its own embedded audio file.

Through the duration of the main timeline I have chapter buttons with evenlisteners to send the playhead to the corresponding frame where that movie clip begins.

This seems to work, except I noticed that when I try to "skip" frames, it does something unpredictable. Example: when trying to advance from the chapter 1 movie clip area of the main timeline to where the chapter 3 movie clip begins, it does this, but it ALSO inexplicably plays just the audio from the chapter 2 movie clip, which is in between the two points.

Does this make any sense? I appreciate help, it is driving me mad. I may figure it out yet but I've been stuck on it for an hour.

Lou

maskedMan
12-23-2008, 06:33 PM
Finally, someone else runs across this bug!

You've witnessed one of the many ways in which audio is utterly broken in Flash post CS3. You can't do what you're trying to do. Period. If you have sound on a timeline that is buried 2 or more levels deep, you run the risk of all your audio in those buried clips instantiating and playing just because the playhead skips over the containing clips on the timeline even though you never actually rendered them.

Instead of placing each chapter on the stage at authortime, you can instead simply place 'chapter 1' on one frame, and when you go to chapter 2, instead of gotoAndPlay/gotoAndStop you would use removeChild to remove chapter 1 from the stage, instantiate a new instance of chapter 2 from the library, and then use addChild to add your newly created chapter 2. This holds for any particular chapter you want to instantiate. Just be mindful that you clean things up in your chapter before you remove it.