BUG: Resume sample action restarts the sample
I have just realized that when I pause a sample and then resume a sample, the sample being resumed restarts from the beginning, instead of resuming where it was before the pause. This only happens in the Flash runtime (swf) and NOT in the MMF2 debugger.
Is there any workaround for this in the meantime?
Mobichan
Re: BUG: Resume sample action restarts the sample
This is a known issue we stumbled upon during the beta tests, actually Flash itself is flawed:
http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/
In that blog, we can read in one of the last comment that this issue is now addressed in Flash CS5. So maybe there is something to do?
There is no workaround that I'm aware of.
Re: BUG: Resume sample action restarts the sample
I am not quite sure how a fix in the Flash IDE will be applicable to the Flash exporter in MMF2. Unless it is a change in AS3?
I wonder if setting the volume to 0 for that sample would be a workaround.
EDIT: Looks like I can get away with setting the volume to 0 on that sample's channel. It doesn't pause the music, but at least it doesn't reset it. Hopefully this can be resolved in a future exporter update.
Re: BUG: Resume sample action restarts the sample
I spoke too soon. Apparently you have no control over the channel volume in the Flash exporter? I tried it in debug and it worked, but once again the swf was a different story. Should the volume options be grayed out if the file is set to Flash exporter type?
Re: BUG: Resume sample action restarts the sample
I am using "Set Channel Volume" without problems. What code are you using, maybe there's something wrong with it?
Re: BUG: Resume sample action restarts the sample
Set Channel Volume to 0 when my pause code is activated. Then Set Channel Volume to 100 when the game is resumed. My pause code is done with groups being activated/deactivated.
2 Attachment(s)
Re: BUG: Resume sample action restarts the sample
Well, I don't see what is going wrong mobichan. Please see the attached test app which we were using to chase bugs related to sound playback. This app shows on a single frame all the Sound actions/conditions/expressions available for the Flash runtime.
Almost all the features do work in the compiled .swf for me (I'm currently using b252). What does not work as far as I can tell:
- Resuming a looped sample. When doing this the sample will restart from the beginning as well as its loop count.
- The Sample/Channel position expressions return 0 when the Sample/Channel is paused.
Re: BUG: Resume sample action restarts the sample
Things seems to work fine for me if I build that test app as a swf. This is starting to become maddening, since I only set the volume for channel 1 (the channel I am trying to pause/silence) in a single place in the code. When something needs the game to pause, I am enabling a group called "Pause" that has 2 lines of code in it:
+ Flag 0 is OFF
- Set Channel 1 volume to 0
- Set Flag 0 ON
- Disable group "Pause"
+Flag 0 is ON
- Set Channel volume to 100
- Set Flag 0 OFF
- Disable Group "Pause"
Outside of that group I always set Flag 0 OFF. I have some other code that fires just fine in the Pause group code (which I left out of my example). And since this works just fine in exe, I can only guess that there is something that the Flash exporter is doing slightly different.
Any other ideas what might be happening?
Re: BUG: Resume sample action restarts the sample
Uploaded a super simple version of the bug:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=246961&#Post246 961
Just press the "P" key and the volume should go to 0. It works in EXE but not SWF.
Re: BUG: Resume sample action restarts the sample
The events where you set the main volume conflict with the events where you set the channel volume. In other words setting the main volume affects the volume of all the channels/samples. Yes, this is another difference between the Flash and the regular runtime.
To solve your problem just add a condition "Only one action when event loops" in your events on lines 4 and 5.
Re: BUG: Resume sample action restarts the sample
Thanks for the help. That fixed the issue. :) Any idea if the original looping issue will be fixed in the future? That is still the way I would like this to ideally work.