简体   繁体   中英

AS3 adobe air Movie clips sounds playing even when movie clip is skipped on main timeline

I'm very new to developing for android through Adobe Air, and semi new to using actionscript 3.

I'm recoding an old actionscript 2 game I made as actionscript 3 and android deployment, and have been going well with the coding part, no problems. But one strange issue has me stumped!

When I skip a movie clip on a timeline, any sound on the timeline of that movie clip or any movie clips within it starts playing! I'm not sure how the movieclip even exists after being skipped, or why it would ignore any stops(); on the timeline of that movieclip and play the sound anyway.

For example, I have my main menu on frame 3. One of the functions for a button there sends the main timeline to gotoAndStop frame 6, where my actual game screen is located. However, there is a mission briefing movieclip on frame 4, and the audio for this movieclip plays after skipping from frame 3 to frame 6, even though if it were somehow to exist it should not play the audio since there is a stop(); on it's frame 1 before the streaming audio begins.

I had similar problems with map objects in my massive map sections movieclip, Eg. skipping to map number 100 would play various sounds from movieclips present on frames 1-99 of that map MC, over and over.

Any ideas how this could happen? I always assumed timeline frames skipped with a gotoAndWhatever were not actually loaded, and even if they were any MC's present on skipped frames should no exist after that frame is no longer the current timeline frame.

I have been having hardware problems with my pc and a new one comes in a week, but I don't think this is the reason for this problem.

Any ideas?

////EDIT UPDATE Ok, so I did a test. I started a new adobe air file. I then created a movieclip with an event sound inside it, on frame 99, then added a stop on frame 100. I then placed that movieclip on frame 5 of the main timeline. On frame 1 of the main timeline, i put a gotoAndStop 10 and added a blank frame there for it to land on. This works fine, no sounds played and my MC was skipped properly.

BUT if when i converted that movieclip to a movieclip again (so two layers of movieclip now, with the sound inside the child movieclip) and now the sound plays when skipped, over and over again, ignoring the stop i placed after it... I hope I explained that well enough, I'm stumped!!

Taken from http://forums.adobe.com/message/4451672 :

Click in the frame that has audio. Open the properties panel and check the Sync drop-down. It is set to Event by default. Change it to stream. Now make sure the frame that has the audio has enough frames to play the full audio.

By using Sync:Event you are asking flash to play the audio in the frame regardless if it's in that frame or not. Stream only plays if the playhead is currently playing that clip. The second the playhead is outside the clip, when set to stream, it will stop playing.

So in your screenshot, after you set Sync:Stream you will need to add frames (F5) to the layer that contains the audio (you can see the waveform). If you don't you'll only hear however many frames of audio you extend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM