<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog do PacMan &#187; actionscript</title>
	<atom:link href="http://pacman.blog.br/blog/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://pacman.blog.br/blog</link>
	<description>Varias Coisas, por Tiago Peczenyj</description>
	<lastBuildDate>Thu, 26 Jan 2012 13:51:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Como saber que uma musica acabou em actionscript</title>
		<link>http://pacman.blog.br/blog/dicas/como-saber-que-uma-musica-acabou-em-actionscript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=como-saber-que-uma-musica-acabou-em-actionscript</link>
		<comments>http://pacman.blog.br/blog/dicas/como-saber-que-uma-musica-acabou-em-actionscript/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 15:03:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Dicas]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[programação]]></category>

		<guid isPermaLink="false">http://pacman.blog.br/blog/dicas/como-saber-que-uma-musica-acabou-em-actionscript/</guid>
		<description><![CDATA[Para fazer um tocador de mp3, por exemplo, em actionscript 3, basta vc criar uma instância da classe Sound e invocar os métodos load e play para carregar o arquivo e toca-lo, respectivamente. Porém como saber que a musica acabou? &#8230; <a href="http://pacman.blog.br/blog/dicas/como-saber-que-uma-musica-acabou-em-actionscript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Para fazer um tocador de mp3, por exemplo, em actionscript 3, basta vc criar uma instância da classe Sound e invocar os métodos load e play para carregar o arquivo e toca-lo, respectivamente.</p>
<p>Porém como saber que a musica acabou? A classe sound possui um listener para o evento COMPLETE porém isto é para completar o donwload da musica, não o final da mesma. E ai, comofas/</p>
<p>Simples: o método play retorna uma instância SoundChannel que, por sua vez, possui um listener para o evento SOUND_COMPLETE, logo bastaria fazer</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> snd<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sound</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sound</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
snd<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;jazz.mp3&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> channel<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">SoundChannel</span> = snd<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
channel<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">SOUND_COMPLETE</span><span style="color: #000066; font-weight: bold;">,</span> 
      soundCompleteHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> soundCompleteHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
  <span style="color: #009966; font-style: italic;">/* insira aqui o que deve fazer quando a musica acabar */</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://pacman.blog.br/blog/dicas/como-saber-que-uma-musica-acabou-em-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

