<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: AS3 Sound Channel Bug</title>
	<atom:link href="http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/</link>
	<description>Adobe, Flash, Flex, AIR, Technology</description>
	<lastBuildDate>Thu, 18 Mar 2010 22:50:52 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Charles Miller</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-19595</link>
		<dc:creator>Charles Miller</dc:creator>
		<pubDate>Mon, 15 Feb 2010 16:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-19595</guid>
		<description>I found a satisfactory solution @ http://tudway.blogspot.com/2008/04/sound-in-flash-cs3-part-2-pause.html</description>
		<content:encoded><![CDATA[<p>I found a satisfactory solution @ <a href="http://tudway.blogspot.com/2008/04/sound-in-flash-cs3-part-2-pause.html" rel="nofollow">http://tudway.blogspot.com/2008/04/sound-in-flash-cs3-part-2-pause.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Barrante</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-18708</link>
		<dc:creator>Stephen Barrante</dc:creator>
		<pubDate>Fri, 22 Jan 2010 16:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-18708</guid>
		<description>@all

You may be pleased to know that this issue appears to be addressed in Flash CS5.

I just put together a test, and on EnterFrame, displayed the channel.position of the looping clip. The looping was set during channel.play(lastposition, 999);

It resets the position to 0(zero) each time it enters a new loop, so my pause button (which stores the current position) works properly each time I resume.</description>
		<content:encoded><![CDATA[<p>@all</p>
<p>You may be pleased to know that this issue appears to be addressed in Flash CS5.</p>
<p>I just put together a test, and on EnterFrame, displayed the channel.position of the looping clip. The looping was set during channel.play(lastposition, 999);</p>
<p>It resets the position to 0(zero) each time it enters a new loop, so my pause button (which stores the current position) works properly each time I resume.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jo</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-16010</link>
		<dc:creator>Jo</dc:creator>
		<pubDate>Mon, 26 Oct 2009 20:15:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-16010</guid>
		<description>@vladimir &amp; @ joshua

I like Vladimir&#039;s solution. I think the reason you might be getting errors is that each time it loops it adds a listener.

I just added a removeEventListener before before the addEventListener (seems to work)

Although I have not figured out how to change the volume once this loop has started... I think I have tried everything, but if anyone has a tip I would appreciate it.

@others

I have tried the formula -
newPosition = channel.position % sound.length

This has constantly failed for me no matter how I work with it... I still get weird loops. It actually cuts my loops in half each time i pause and start... which after a few times leaves me with a really loud annoying noise.</description>
		<content:encoded><![CDATA[<p>@vladimir &amp; @ joshua</p>
<p>I like Vladimir&#039;s solution. I think the reason you might be getting errors is that each time it loops it adds a listener.</p>
<p>I just added a removeEventListener before before the addEventListener (seems to work)</p>
<p>Although I have not figured out how to change the volume once this loop has started&#8230; I think I have tried everything, but if anyone has a tip I would appreciate it.</p>
<p>@others</p>
<p>I have tried the formula -<br />
newPosition = channel.position % sound.length</p>
<p>This has constantly failed for me no matter how I work with it&#8230; I still get weird loops. It actually cuts my loops in half each time i pause and start&#8230; which after a few times leaves me with a really loud annoying noise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chichilatte</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-11024</link>
		<dc:creator>chichilatte</dc:creator>
		<pubDate>Fri, 22 May 2009 13:18:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-11024</guid>
		<description>This is a bit of an oversight from Adobe. 
So the upshot is you can&#039;t pause a looping sound without handcoding an onComplete handler with your own manual loop counter, making things much more complex than they need to be. 
And if you want the loop to be seamless, forget it. Ouch.</description>
		<content:encoded><![CDATA[<p>This is a bit of an oversight from Adobe.<br />
So the upshot is you can&#039;t pause a looping sound without handcoding an onComplete handler with your own manual loop counter, making things much more complex than they need to be.<br />
And if you want the loop to be seamless, forget it. Ouch.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-9226</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Tue, 31 Mar 2009 06:12:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-9226</guid>
		<description>Nice idea Vladimir,
Thanks for your solution.

Unfortunately, I have found another AS3 Sound bug during use your solution. The the SOUND_COMPLETE event gose crazy after call over 4~500 times the snd.play() method. The SOUND_COMPLETE event raises too slow, it raise when flash want.</description>
		<content:encoded><![CDATA[<p>Nice idea Vladimir,<br />
Thanks for your solution.</p>
<p>Unfortunately, I have found another AS3 Sound bug during use your solution. The the SOUND_COMPLETE event gose crazy after call over 4~500 times the snd.play() method. The SOUND_COMPLETE event raises too slow, it raise when flash want.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-7878</link>
		<dc:creator>Vladimir</dc:creator>
		<pubDate>Wed, 04 Feb 2009 17:19:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-7878</guid>
		<description>There is one &quot;workaround&quot;...

Do not use repating sound clip (set it to 1) and then add listener to SOUND_COMPLETE where you will play sound from position 0 again).

Below is a function that plays hides this and plays from a given position (so that you can play/pause). This function also preserves current soundTransgorm (i.w., volue and pan). 

function playClip(snd:Sound, chn:SoundChannel, pos:Number):void {
	chn = snd.play(pos, 1, (chn != null ? chn.soundTransform : null));
	chn.addEventListener(Event.SOUND_COMPLETE, function(event:Event):void {playClip(0)});
}

I hope that this helps...</description>
		<content:encoded><![CDATA[<p>There is one &#034;workaround&#034;&#8230;</p>
<p>Do not use repating sound clip (set it to 1) and then add listener to SOUND_COMPLETE where you will play sound from position 0 again).</p>
<p>Below is a function that plays hides this and plays from a given position (so that you can play/pause). This function also preserves current soundTransgorm (i.w., volue and pan). </p>
<p>function playClip(snd:Sound, chn:SoundChannel, pos:Number):void {<br />
	chn = snd.play(pos, 1, (chn != null ? chn.soundTransform : null));<br />
	chn.addEventListener(Event.SOUND_COMPLETE, function(event:Event):void {playClip(0)});<br />
}</p>
<p>I hope that this helps&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: April</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-7025</link>
		<dc:creator>April</dc:creator>
		<pubDate>Fri, 19 Dec 2008 16:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-7025</guid>
		<description>Use it in good health!

pausePosition = channel.position%this.music.length;</description>
		<content:encoded><![CDATA[<p>Use it in good health!</p>
<p>pausePosition = channel.position%this.music.length;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebben</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-6646</link>
		<dc:creator>Sebben</dc:creator>
		<pubDate>Sun, 07 Dec 2008 00:48:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-6646</guid>
		<description>Please explain the modulus solution a little more? I can only get it to loop from the start not from where I paused it.</description>
		<content:encoded><![CDATA[<p>Please explain the modulus solution a little more? I can only get it to loop from the start not from where I paused it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-5707</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 10 Nov 2008 06:11:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-5707</guid>
		<description>Does AS3 not have a modulus function?  If so,  position [mod] length would return the position you&#039;re looking for.</description>
		<content:encoded><![CDATA[<p>Does AS3 not have a modulus function?  If so,  position [mod] length would return the position you&#039;re looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maliboo</title>
		<link>http://www.stevensacks.net/2008/08/07/as3-sound-channel-bug/comment-page-1/#comment-2630</link>
		<dc:creator>maliboo</dc:creator>
		<pubDate>Thu, 07 Aug 2008 13:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=143#comment-2630</guid>
		<description>currentPosition = position%length;</description>
		<content:encoded><![CDATA[<p>currentPosition = position%length;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
