简体   繁体   English

AS3 adobe air即使在主时间轴上跳过影片剪辑,也会播放影片剪辑

[英]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. 我对通过Adobe Air为android开发游戏非常陌生,对使用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. 我正在重新编码作为ActionScript 3和android部署制作的旧的ActionScript 2游戏,并且在编码部分进行得很顺利,没有问题。 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(); 我不确定影片剪辑在被跳过后如何存在,或者为什么它会忽略任何stop(); 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. 例如,我的主菜单位于第3帧。按钮的功能之一将主时间轴发送到gotoAndStop第6帧,这是我的实际游戏屏幕所在的位置。 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(); 但是,在第4帧上有一个任务简报动画片段,并且从第3帧跳到第6帧后,该动画片段的音频会播放,即使它存在某种原因也不会播放音频,因为存在stop(); on it's frame 1 before the streaming audio begins. 在流音频开始之前的第1帧上。

I had similar problems with map objects in my massive map sections movieclip, Eg. 我在大量的地图部分Movieclip中遇到了类似的地图对象问题,例如。 skipping to map number 100 would play various sounds from movieclips present on frames 1-99 of that map MC, over and over. 跳到地图编号100将会反复播放来自该地图MC的帧1-99上存在的电影剪辑的各种声音。

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. 我一直以为实际上没有使用gotoAndWhatever跳过的时间轴帧实际上并未加载,即使它们是跳过的帧上存在的任何MC,在该帧不再是当前时间轴帧之后也不应存在。

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. 我的PC一直存在硬件问题,一周后会出现一个新问题,但是我不认为这是造成此问题的原因。

Any ideas? 有任何想法吗?

////EDIT UPDATE Ok, so I did a test. ////编辑更新好的,所以我做了一个测试。 I started a new adobe air file. 我启动了一个新的Adobe Air文件。 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. 然后,在第99帧上创建了一个带有事件声音的动画片段,然后在第100帧上添加了一个停止。然后,将该动画片段放在主时间轴的第5帧上。 On frame 1 of the main timeline, i put a gotoAndStop 10 and added a blank frame there for it to land on. 在主时间轴的第1帧上,我放置了gotoAndStop 10并在其中添加了空白帧以使其落在上面。 This works fine, no sounds played and my MC was skipped properly. 这样工作正常,没有声音播放,并且我的MC已正确跳过。

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!! 但是如果当我再次将那个MovieClip转换成一个MovieClip时(那么现在是两层MovieClip,声音在子MovieClip中)并且现在声音在跳过时一遍又一遍地播放,而忽略了我停在它后面的音调...我希望我解释得足够好,我很沮丧!

Taken from http://forums.adobe.com/message/4451672 : 取自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. 通过使用Sync:Event,您将要求Flash播放帧中的音频,而不管它是否在该帧中。 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). 因此,在屏幕快照中,设置Sync:Stream后,您需要将帧(F5)添加到包含音频的图层(您可以看到波形)。 If you don't you'll only hear however many frames of audio you extend. 如果不这样做,您只会听到扩展的音频帧数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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