<?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>Igor Costa &#187; AS 3.0</title>
	<atom:link href="http://www.igorcosta.com/blog/index.php?feed=rss2&#038;cat=6" rel="self" type="application/rss+xml" />
	<link>http://www.igorcosta.com/blog</link>
	<description>Ajudar aos outros da ao sucesso o verdadeiro significado</description>
	<lastBuildDate>Mon, 06 Sep 2010 17:22:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dica: Criando um componente de relógio para seu Flex 2/3 e até 4</title>
		<link>http://www.igorcosta.com/blog/?p=952</link>
		<comments>http://www.igorcosta.com/blog/?p=952#comments</comments>
		<pubDate>Tue, 08 Dec 2009 16:46:08 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 3 how to]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[DateFormatter]]></category>
		<category><![CDATA[Event.ENTER_FRAME]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=952</guid>
		<description><![CDATA[
			
				
			
		
Dando aquela geral nos e-mails não respondidos para finalizar o ano sem pendências, acabei achando relíquias nos arquivos, 4 grandes leitores tinham a mesma dúvida em comum. &#8220;Preciso criar um relógio para meu aplicativo Flex,sem que consuma memória e que seja elegante&#8221;. Quarto com a mesma dúvida? É o mesmo que matar 4 coelhos em [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D952"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D952&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Dando aquela geral nos e-mails não respondidos para finalizar o ano sem pendências, acabei achando relíquias nos arquivos, 4 grandes leitores tinham a mesma dúvida em comum. &#8220;Preciso criar um relógio para meu aplicativo Flex,sem que consuma memória e que seja elegante&#8221;. Quarto com a mesma dúvida? É o mesmo que matar 4 coelhos em uma cajadada só, esperto! Esperto mais ainda é se eu escrever isso aqui e daqui algum tempo alguém, esperto também use o mecanismo de busca do site para achar essa dica. </p>
<p>A mágica do relógio é super simples:</p>
<p>Ingredientes:</p>
<p>DateFormatter<br />
Event.ENTER_FRAME<br />
Global.Date;</p>
<p><strong>Componente Relógio:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Label enterFrame=<span style="color: #ff0000;">&quot;showClock(event)&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;df.formatString = 'JJ:NN:SS'&quot;</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import mx.formatters.DateFormatter;</span>
&nbsp;
&nbsp;
<span style="color: #000000;">				private var df:DateFormatter = new DateFormatter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">				private function showClock<span style="color: #66cc66;">&#40;</span>e:Event<span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">						this.text =  df.format<span style="color: #66cc66;">&#40;</span>new Date<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

<p>Só copiar para dentro de seu projeto Flex, de preferência para seu diretório de componentes, e usar assim em seu aplicativo.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> xmlns:blogtips=<span style="color: #ff0000;">&quot;br.com.igorcosta.blogtips.*&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;blogtips :Relogio<span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

<p><strong>Explicando:</strong> Nem tem muito o que explicar do exemplo, já que o grande formatter ai do tipo DateFormatter, foi o responsável em geral por sempre formatar uma nova Date() object toda vez que entrar um novo Frame, e como por padrão o Frame do Flex é 24fps, então ele roda bem suave.</p>
<p>Da próxima vez que você ver alguém precisando de um relógio, avisa a ele deste post. Até a próxima.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=952</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gravação da palestra &#8211; &#8220;Advanced data visualization&#8221; disponível</title>
		<link>http://www.igorcosta.com/blog/?p=920</link>
		<comments>http://www.igorcosta.com/blog/?p=920#comments</comments>
		<pubDate>Wed, 14 Oct 2009 21:10:02 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript Frameworks]]></category>
		<category><![CDATA[Eventos]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex 3 SDK]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Sexta-Flex Talkshow]]></category>
		<category><![CDATA[Axiis]]></category>
		<category><![CDATA[sextaflex]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=920</guid>
		<description><![CDATA[
			
				
			
		
Quem compareceu ao último sextaflex não pode reclamar, foi excelente o evento e o Michel Vandaniker mandou ver no Axiis para todos os 18 participantes ao total presente no evento on-line.
Caso você por algum motivo que seja perdeu e quer acessar, você pode acessar o link da gavação abaixo.
http://experts.na3.acrobat.com/p38851909/
Obrigado a todos que compareceram.
Nesta semana dia [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D920"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D920&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Quem compareceu ao último sextaflex não pode reclamar, foi excelente o evento e o Michel Vandaniker mandou ver no Axiis para todos os 18 participantes ao total presente no evento on-line.<br />
Caso você por algum motivo que seja perdeu e quer acessar, você pode acessar o link da gavação abaixo.</p>
<p><a href="http://experts.na3.acrobat.com/p38851909/">http://experts.na3.acrobat.com/p38851909/</a></p>
<p>Obrigado a todos que compareceram.</p>
<p>Nesta semana dia 16/10 não haverá sextaflex por motivo de força maior. Não somos muito de reclamar das coisas, mais tem sido bem corrido, em resumo todo mundo decidiu usar Flex de uma única vez e nesse final de ano.</p>
<p>Na próxima semana já temos engatado mais 1 palestrante nacional e vai falar de seus cases e você vai conhecer novas empresas que produzem RIA com qualidade. Queremos mostrar e dar vitrine para todas as minúsculas até as golias das empresas Brasileiras o espaço para ir falando de suas dificuldades e sucessos com a escolha do Flex. Afinal Flex não é só flores.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=920</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sexta-Flex &#8211; Criando visualizações de dados avançados com Axiis</title>
		<link>http://www.igorcosta.com/blog/?p=914</link>
		<comments>http://www.igorcosta.com/blog/?p=914#comments</comments>
		<pubDate>Tue, 06 Oct 2009 02:06:38 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript Frameworks]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 3 Charts]]></category>
		<category><![CDATA[Flex Componentes]]></category>
		<category><![CDATA[Sexta-Flex Talkshow]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[Axiis]]></category>
		<category><![CDATA[Data Visualization]]></category>
		<category><![CDATA[Open-source]]></category>
		<category><![CDATA[Sexta-Flex]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=914</guid>
		<description><![CDATA[
			
				
			
		

Na próxima sexta-flex, no mesmo horário vamos ter um encontro com o Michael VanDaniker, ele é co-autor do framework open-source que mudou a maneira como dados são exibidos na plataforma Flex.
Se você fica babando por que vê os tão belos feitos do Flex Data Visualization, (charts). Então você precisa conhecer o Axiis.
Veja os detalhes da [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D914"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D914&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="http://www.igorcosta.com/blog/wp-content/uploads/2009/10/axiis.jpg" alt="axiis" title="axiis" width="599" height="208" class="alignnone size-full wp-image-915" /></p>
<p>Na próxima sexta-flex, no mesmo horário vamos ter um encontro com o <a href="http://michaelvandaniker.com/blog/">Michael VanDaniker</a>, ele é co-autor do framework open-source que mudou a maneira como dados são exibidos na plataforma Flex.</p>
<p>Se você fica babando por que vê os tão belos feitos do Flex Data Visualization, (charts). Então você precisa conhecer o <a href="http://www.axiis.org">Axiis</a>.<br />
Veja os detalhes da palestra e vê se não perde. Claro que agente entende se você não puder assistir ao vivo, depois ela será gravada.</p>
<p>Palestra On-line<br />
Titulo : Advanced Data Visualization with Axiis<br />
Palestrante: Michel VanDaniker<br />
Horário: Sempre no mesmo horário: das 09:00 AM até as 10:00 horário de Brasília.<br />
Endereço para acesso: <a href="http://experts.na3.acrobat.com/palestras/">http://experts.na3.acrobat.com/palestras/</a><br />
Palestra em inglês.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=914</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Como posicionar o Alert nos valores x e y que eu queira?</title>
		<link>http://www.igorcosta.com/blog/?p=859</link>
		<comments>http://www.igorcosta.com/blog/?p=859#comments</comments>
		<pubDate>Wed, 05 Aug 2009 03:27:20 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex 3 Open-Source]]></category>
		<category><![CDATA[Flex 3 SDK]]></category>
		<category><![CDATA[Flex Componentes]]></category>
		<category><![CDATA[Flex Hacks]]></category>
		<category><![CDATA[Alert]]></category>
		<category><![CDATA[Componente]]></category>
		<category><![CDATA[Flex SDK]]></category>
		<category><![CDATA[PopUpManager]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=859</guid>
		<description><![CDATA[
			
				
			
		
Com as mesmas palavras recebidas no título do e-mail enviado pelo Carlos Brandão sobre suas dificuldades em posicionar o componente Alert, escrevemos o título deste post.
Sem dúvidas é um problema simples, antigo e de fácil resolução. Porém muitos desenvolvedores acabam no final achando mais cômodo colocar o Alert em sua posição original, no centro da [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D859"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D859&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Com as mesmas palavras recebidas no título do e-mail enviado pelo Carlos Brandão sobre suas dificuldades em posicionar o componente Alert, escrevemos o título deste post.<br />
Sem dúvidas é um problema simples, antigo e de fácil resolução. Porém muitos desenvolvedores acabam no final achando mais cômodo colocar o Alert em sua posição original, no centro da tela.</p>
<p>Em via das dúvidas, o mais correto seria imitar o Delphi, C#, Swing. Em deixar o desenvolvedor alertar alguma mensagem na posição que ele queira; Já que nativamente se você colocar o parent ele posiciona no container desejado o alerta na posição central referente ao tamanho e posição daquele container. No ambito de melhor experiência é bem mais agradável mostrar a mensagem de alerta onde o usuário esta usando naquele momento.</p>
<p>O Alert é um componente baseado em Panel, uma vez que ele possui apenas 1 método estático chamado show, ele cria 1 popUp por vez usando o PopUpManager direto no global do Application , comportamento esse que é padrão. Se você já é um usuário avançado do Flex com toda certeza você já deve ter implementado isso, analisando o código fonte do SDK.<br />
Como ele é baseado em um Panel e por sua vez é herdado do UIComponent, ele possui tamanho, posição, cor, propriedades do Panel como a propriedade status, em fim uma gama de novas propriedades que podem ser usadas.</p>
<p>Para ajudar o Carlos, segue uma classe simples que faz todo esse trabalho, é definida por uma propriedade booleanada chamada posicionar que por padrão é false para deixar o mesmo comportamento original do Alert, e caso ela venha a ser alterada para true e suas posições x e y forem alteradas, ela fará um novo posicionamento do Alert para o local que você precisa. Veja como isso pode ser feito. </p>
<p>Classe utilitária para criação do Alerta costumizado.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package org.<span style="color: #006600;">igorcosta</span>.<span style="color: #006600;">alert</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">managers</span>.<span style="color: #006600;">PopUpManager</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Alerta
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">/**
		 * @Author www.igorcosta.org
		 * */</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Alerta<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #808080; font-style: italic;">/**
		 * @public 
		 * 
		 * Método estático que cria um Alert na posição desejada pelo usuário.
		 * 
		 * Por padrão é desabilitado o posicionamento, caso você queira usar o posicionamento você
		 * deve passar o parametro posicionar como true e definir os pontos x e y para se Alert.
		 * vale resaltar que os valores para o posicionamento de x e y são por padrão iguais a 0.
		 * Caso você defina apenas os valores de x e y e deixar o valor original de posicionar como false
		 * não ocorrerá as mudanças.
		 * @return Alert
		 * */</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span>mensagem:<span style="color: #0066CC;">String</span>,titulo:<span style="color: #0066CC;">String</span>,posicionar:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">false</span>,xPos:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>,yPos:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>,flags:uint=<span style="color: #cc66cc;">4</span>,parent:Sprite=<span style="color: #000000; font-weight: bold;">null</span>,closehandler:<span style="color: #000000; font-weight: bold;">Function</span> =<span style="color: #000000; font-weight: bold;">null</span>,icon:<span style="color: #000000; font-weight: bold;">Class</span> = <span style="color: #000000; font-weight: bold;">null</span>,defaultbuttonFlag:uint =<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>:Alert<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> alerta:Alert = Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span>mensagem,titulo,flags,parent,closehandler,icon,defaultbuttonFlag<span style="color: #66cc66;">&#41;</span>;
			Alert.<span style="color: #006600;">yesLabel</span> = <span style="color: #ff0000;">'Sim'</span>;
			Alert.<span style="color: #006600;">noLabel</span> = <span style="color: #ff0000;">'Não'</span>;
			Alert.<span style="color: #006600;">cancelLabel</span> = <span style="color: #ff0000;">'Cancelar'</span>;
			Alert.<span style="color: #006600;">okLabel</span> = <span style="color: #ff0000;">'OK'</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>posicionar ==<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			PopUpManager.<span style="color: #006600;">centerPopUp</span> <span style="color: #66cc66;">&#40;</span>alerta<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> internalX:<span style="color: #0066CC;">Number</span> = xPos;
			<span style="color: #000000; font-weight: bold;">var</span> internalY:<span style="color: #0066CC;">Number</span> = yPos;
			alerta.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span>internalX,internalY<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
				PopUpManager.<span style="color: #006600;">centerPopUp</span> <span style="color: #66cc66;">&#40;</span>alerta<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> alerta;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Aplicação da classe:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import org.igorcosta.alert.Alerta;</span>
&nbsp;
<span style="color: #000000;">			public function alertar<span style="color: #66cc66;">&#40;</span>e:MouseEvent<span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				Alerta.show<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'mensagem de boas vindas'</span>,<span style="color: #ff0000;">'teste'</span>,true,e.currentTarget.x,e.currentTarget.y<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;mx :Button id=<span style="color: #ff0000;">&quot;btn&quot;</span> click=<span style="color: #ff0000;">&quot;alertar(event)&quot;</span> x=<span style="color: #ff0000;">&quot;31&quot;</span> y=<span style="color: #ff0000;">&quot;23&quot;</span> width=<span style="color: #ff0000;">&quot;61&quot;</span> height=<span style="color: #ff0000;">&quot;32&quot;</span> label=<span style="color: #ff0000;">&quot;Click&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;">&lt;mx :Button id=<span style="color: #ff0000;">&quot;btn0&quot;</span> click=<span style="color: #ff0000;">&quot;alertar(event)&quot;</span> x=<span style="color: #ff0000;">&quot;538&quot;</span> y=<span style="color: #ff0000;">&quot;23&quot;</span> width=<span style="color: #ff0000;">&quot;61&quot;</span> height=<span style="color: #ff0000;">&quot;32&quot;</span> label=<span style="color: #ff0000;">&quot;Click&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;">&lt;mx :Button id=<span style="color: #ff0000;">&quot;btn1&quot;</span> click=<span style="color: #ff0000;">&quot;alertar(event)&quot;</span> x=<span style="color: #ff0000;">&quot;538&quot;</span> y=<span style="color: #ff0000;">&quot;338&quot;</span> width=<span style="color: #ff0000;">&quot;61&quot;</span> height=<span style="color: #ff0000;">&quot;32&quot;</span> label=<span style="color: #ff0000;">&quot;Click&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;">&lt;mx :Button id=<span style="color: #ff0000;">&quot;btn2&quot;</span> click=<span style="color: #ff0000;">&quot;alertar(event)&quot;</span> x=<span style="color: #ff0000;">&quot;31&quot;</span> y=<span style="color: #ff0000;">&quot;338&quot;</span> width=<span style="color: #ff0000;">&quot;61&quot;</span> height=<span style="color: #ff0000;">&quot;32&quot;</span> label=<span style="color: #ff0000;">&quot;Click&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=859</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Suavizar imagem no Flex/Flash</title>
		<link>http://www.igorcosta.com/blog/?p=780</link>
		<comments>http://www.igorcosta.com/blog/?p=780#comments</comments>
		<pubDate>Thu, 12 Feb 2009 00:57:23 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Dicas]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash CS 3]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=780</guid>
		<description><![CDATA[
			
				
			
		
Tivemos uma surpresa hoje pela manhã, chegaram 8 e-mails perguntando a mesma coisa, como deixar a imagem mais suave quando o container ou moviclip que será despejada é menor.
O que acontece é que enquanto o Bitmap não estive preenchido ou melhor completo ao processo de carregar a imagem, o Bitmap em sí fica null, não [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D780"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D780&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Tivemos uma surpresa hoje pela manhã, chegaram 8 e-mails perguntando a mesma coisa, como deixar a imagem mais suave quando o container ou moviclip que será despejada é menor.</p>
<p>O que acontece é que enquanto o Bitmap não estive preenchido ou melhor completo ao processo de carregar a imagem, o Bitmap em sí fica null, não é somente no Flex mais também no Flash.</p>
<p>Para solucionar o problema no Flash, aconselho ler isso aqui no <a href="http://www.gskinner.com/blog/archives/2007/08/minor_bug_with.html">blog do GSkinner</a>(<em>inglês</em>).</p>
<p>Para o Flex, é fácil, adicione no evento complete=&#8221;"  ao campo de Imagem.</p>
<pre name="code" class="xslt">
	<mx :Image creationComplete="(pa.content as Bitmap).smoothing=true" id="pa" x="36" y="34" source="assets/imagem.jpg" width="834" height="553"/>
</pre>
<p>Feito isso você pode aliviar os pixels mal posicionados na tela, Essa opção mudou muito no Flash Player 10, ficando bem melhor o resultado do que no Flash Player 9.</p>
<p>Existem outros links de referências que valem o click:<br />
<a href="http://www.kevin-fitzpatrick.net/blog/?p=10">http://www.kevin-fitzpatrick.net/blog/?p=10</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=780</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3D na sua aplicação Flex usando apenas os novos recursos do Flash Player 10</title>
		<link>http://www.igorcosta.com/blog/?p=774</link>
		<comments>http://www.igorcosta.com/blog/?p=774#comments</comments>
		<pubDate>Wed, 11 Feb 2009 19:02:55 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 3 SDK]]></category>
		<category><![CDATA[Flex 3 how to]]></category>
		<category><![CDATA[Flex Builder 3]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash Player 10]]></category>
		<category><![CDATA[Flex 3D]]></category>
		<category><![CDATA[Flex SDK]]></category>
		<category><![CDATA[Flex3D]]></category>
		<category><![CDATA[rotationX]]></category>
		<category><![CDATA[rotationY]]></category>
		<category><![CDATA[rotationZ]]></category>
		<category><![CDATA[transtion]]></category>
		<category><![CDATA[Tweener]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=774</guid>
		<description><![CDATA[
			
				
			
		
O título é enorme, mais o conteúdo é de se animar. Eu já havia postado aqui sobre a novidade, só não tinha dito como fazer.Trabalhar com efeitos 3D no Flex é fácil, divertido e te tira uma boa parte do seu tempo pela manhã.
Existem algumas(1) bibliotecas(2) gratuitas(3) que faz esse serviço para a versão do [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D774"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D774&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>O título é enorme, mais o conteúdo é de se animar. Eu já havia <a href="http://www.igorcosta.com/blog/2008/11/habilitando-o-flex-builder-3-ao-flash-player-10/">postado aqui</a> sobre a novidade, só não tinha dito como fazer.Trabalhar com efeitos 3D no Flex é fácil, divertido e te tira uma boa parte do seu tempo pela manhã.</p>
<p>Existem <a href="http://www.efflex.org">algumas<em>(1)</em></a> <a href="http://blog.papervision3d.org/2007/10/04/tinks-papervision3d-effects-for-flex/">bibliotecas<em>(2)</em> </a><a href="http://weblogs.macromedia.com/auhlmann/archives/effects/index.cfm ">gratuitas<em>(3)</em> </a>que faz esse serviço para a versão do Flash Player 9, embora ainda funcionando no Flash Player 10. Mais esse conteúdo é direcionado apenas para quem já tem o Flash Player instalado e quer começar a brincar ou quem sabe aplicar os efeitos de 3D em sua aplicação Flex existente já usando os novos recursos de 3D do Flash Player 10.</p>
<p><strong>Requesitos:</strong></p>
<p>- Ter o Flash Player 10 instalado<br />
- Ter o Adobe Flex Builder 3.0.2+<br />
- Ter tempo disponível de 30 minutos.</p>
<p>Antes de mais nada, para começar você vai precisar alterar algumas coisas do seu Flex Builder 3.0.2, embora ele já venha atualizado, existe uma pequena configuração necessária para rodar. Notadamente essa configuração não terá mais valor para o Flex Builder 4, ou melhor &#8220;gumbo&#8221;,já que por padrão ela vem feita.</p>
<p>Passos para configurar:</p>
<p>1. Vá até o Flex Builder e crie um novo projeto.<br />
2. Depois do projeto criado, clique com o botão direito do mouse sobre o projeto e escolha a opção do menu &#8220;Properties&#8221;.<br />
3. Vai abrir a tela de propriedades do projeto. Nela você deve escolher a opção &#8220;Flex Build Path&#8221;.<br />
<img src="http://www.igorcosta.com/blog/wp-content/uploads/2009/02/3d.jpg" alt="3d" title="3d" width="701" height="658" class="alignnone size-full wp-image-775" /></p>
<p>4. Clique em Flex 3.2 para expandir e delete a biblioteca playerglobal.swc, essa biblioteca é para o Flash Player 9.<br />
5.Clique no botão Add SWC e procure dentro dos arquevos de instalação de sua máquena onde está o seguinte caminho.</p>
<blockquote><p>C:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.2.0\frameworks\libs\player\10\playerglobal.swc</p></blockquote>
<p>Esse novo playerglobal.swc vai garantir que as classes do Player padrão que no caso será o 10, terá todas as classes requesitadas.</p>
<p>Após isso, volte no menu lateral e escolha a opção Flex Compiler, e adicione ao compilador o seguinte parâmetro &#8220;-target-player=10&#8243;. Com isso garantimos que o compilador vai adicionar as classes dependentes para isso.</p>
<p>Feito isso, caso você queira assegurar que o swf gerado seja enxergado e possa refletir as mudanças para o instalador automático, mude a versão do Flash Player que está ai de 9.0.24 para 10.0.0.</p>
<p>Passo final. Clique OK e está salvo as alterações, agora é só contigo.</p>
<p>Entendendo um pouco do 3D do Flash Player 10.</p>
<p>Toda classe do DisplayObject, MovieClip e Sprite, tem novas propriedades cada uma dessas novas propriedades faz a rotação do objeto em um eixo X,Y e Z. As propriedades são: rotationX,rotationY, rotationZ,transformX,transformY,transformZ,scaleX,scaleY,scaleZ, dentre outras classes. Quem trabalha com Flash CS4 <a href="http://help.adobe.com/pt_BR/ActionScript/3.0_ProgrammingAS3/WSF24A5A75-38D6-4a44-BDC6-927A2B123E90.html">pode ver em detalhe como funciona o 3D do Flash Player </a>(em português).</p>
<p>Para quem trabalha com Flash tem-se uma vantagem que é definir o ponto de registro x,y de um objeto quando se está criando, o que você pode fazer com que seu objeto seja rotacionado no eixo existente e assim fazer um efeito conciso.</p>
<p>Já no Flex não temos essa vantagem o que podemos fazer é imitar o Flash IDE nessa parte, colocando qualquer um de nossos componentes como container do componente afetado, complicado né?! Não, por exemplo veja abaixo que apliquei diretamente o efeito de 3D à um painel, observe que ele vai rotacionar no eixo Y de onde os pontos x,y foram registrados.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import caurina.transitions.Tweener;</span>
&nbsp;
&nbsp;
<span style="color: #000000;">			public function rotate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
&nbsp;
<span style="color: #000000;">				Tweener.addTween<span style="color: #66cc66;">&#40;</span>pa,<span style="color: #66cc66;">&#123;</span>rotationY:pa.rotationY+<span style="color: #cc66cc;">180</span>,time:<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
&nbsp;
&nbsp;
	<span style="color: #000000;">&lt;mx :Panel  id=<span style="color: #ff0000;">&quot;pa&quot;</span> x=<span style="color: #ff0000;">&quot;451&quot;</span> y=<span style="color: #ff0000;">&quot;141&quot;</span> width=<span style="color: #ff0000;">&quot;208&quot;</span> height=<span style="color: #ff0000;">&quot;196&quot;</span> title=<span style="color: #ff0000;">&quot;Painel Rotativo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;mx :Button x=<span style="color: #ff0000;">&quot;20&quot;</span> y=<span style="color: #ff0000;">&quot;55&quot;</span> label=<span style="color: #ff0000;">&quot;Rotacionar&quot;</span> click=<span style="color: #ff0000;">&quot;rotate()&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>Agora comportando-se como no Flash IDE, adiciono o painel à um container.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import caurina.transitions.Tweener;</span>
&nbsp;
&nbsp;
<span style="color: #000000;">			public function rotate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
&nbsp;
<span style="color: #000000;">				Tweener.addTween<span style="color: #66cc66;">&#40;</span>pa,<span style="color: #66cc66;">&#123;</span>rotationY:pa.rotationY+<span style="color: #cc66cc;">180</span>,time:<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;mx :Container clipContent=<span style="color: #ff0000;">&quot;false&quot;</span> id=<span style="color: #ff0000;">&quot;pa&quot;</span> width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;300&quot;</span> x=<span style="color: #ff0000;">&quot;513.5&quot;</span> y=<span style="color: #ff0000;">&quot;223&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Panel horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> x=<span style="color: #ff0000;">&quot;-150&quot;</span> y=<span style="color: #ff0000;">&quot;-150&quot;</span> width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;300&quot;</span> title=<span style="color: #ff0000;">&quot;Painel Rotativo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;mx :Button x=<span style="color: #ff0000;">&quot;20&quot;</span> y=<span style="color: #ff0000;">&quot;55&quot;</span> label=<span style="color: #ff0000;">&quot;Rotacionar&quot;</span> click=<span style="color: #ff0000;">&quot;rotate()&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></td></tr></table></div>

<p>Onde depois você pode ir manipulando de uma só vez as três propriedades definidas. Exemplo abaixo:</p>
<p><img src="http://www.igorcosta.com/blog/wp-content/uploads/2009/02/3d2.jpg" alt="3d2" title="3d2" width="649" height="422" class="alignnone size-full wp-image-776" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :Application horizontalScrollPolicy=<span style="color: #ff0000;">&quot;off&quot;</span> verticalScrollPolicy=<span style="color: #ff0000;">&quot;off&quot;</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> width=<span style="color: #ff0000;">&quot;675&quot;</span> height=<span style="color: #ff0000;">&quot;509&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import caurina.transitions.Tweener;</span>
&nbsp;
&nbsp;
<span style="color: #000000;">			public function rotate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
&nbsp;
<span style="color: #000000;">				Tweener.addTween<span style="color: #66cc66;">&#40;</span>pa,<span style="color: #66cc66;">&#123;</span>rotationX:transformaX.value,rotationY:transformaY.value,rotationZ:transformaZ.value,time:<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;mx :Container clipContent=<span style="color: #ff0000;">&quot;false&quot;</span> id=<span style="color: #ff0000;">&quot;pa&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span> height=<span style="color: #ff0000;">&quot;150&quot;</span> x=<span style="color: #ff0000;">&quot;486&quot;</span> y=<span style="color: #ff0000;">&quot;212&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Panel horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> x=<span style="color: #ff0000;">&quot;-75&quot;</span> y=<span style="color: #ff0000;">&quot;-75&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span> height=<span style="color: #ff0000;">&quot;150&quot;</span> title=<span style="color: #ff0000;">&quot;Painel Rotativo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;mx :Button x=<span style="color: #ff0000;">&quot;29&quot;</span> y=<span style="color: #ff0000;">&quot;257&quot;</span> label=<span style="color: #ff0000;">&quot;Rotacionar&quot;</span> click=<span style="color: #ff0000;">&quot;rotate()&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;">&lt;mx :Form x=<span style="color: #ff0000;">&quot;20&quot;</span> y=<span style="color: #ff0000;">&quot;85&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :FormItem label=<span style="color: #ff0000;">&quot;rotationX&quot;</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;mx :HSlider minimum=<span style="color: #ff0000;">&quot;0&quot;</span> labels=<span style="color: #ff0000;">&quot;[0,90,180,270,360]&quot;</span> maximum=<span style="color: #ff0000;">&quot;360&quot;</span> allowTrackClick=<span style="color: #ff0000;">&quot;true&quot;</span> snapInterval=<span style="color: #ff0000;">&quot;15&quot;</span> id=<span style="color: #ff0000;">&quot;transformaX&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;mx :FormItem label=<span style="color: #ff0000;">&quot;rotationY&quot;</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;mx :HSlider minimum=<span style="color: #ff0000;">&quot;0&quot;</span> labels=<span style="color: #ff0000;">&quot;[0,90,180,270,360]&quot;</span> maximum=<span style="color: #ff0000;">&quot;360&quot;</span> allowTrackClick=<span style="color: #ff0000;">&quot;true&quot;</span> snapInterval=<span style="color: #ff0000;">&quot;15&quot;</span> id=<span style="color: #ff0000;">&quot;transformaY&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;mx :FormItem label=<span style="color: #ff0000;">&quot;rotationZ&quot;</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;mx :HSlider minimum=<span style="color: #ff0000;">&quot;0&quot;</span> labels=<span style="color: #ff0000;">&quot;[0,90,180,270,360]&quot;</span> maximum=<span style="color: #ff0000;">&quot;360&quot;</span> allowTrackClick=<span style="color: #ff0000;">&quot;true&quot;</span> snapInterval=<span style="color: #ff0000;">&quot;15&quot;</span> id=<span style="color: #ff0000;">&quot;transformaZ&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=774</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Criando um player de MP3 com Flash CS4 e actionscript 3.0</title>
		<link>http://www.igorcosta.com/blog/?p=769</link>
		<comments>http://www.igorcosta.com/blog/?p=769#comments</comments>
		<pubDate>Mon, 09 Feb 2009 16:00:38 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Actionscript Frameworks]]></category>
		<category><![CDATA[Flash CS 3]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[Flash Componentes]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Sound]]></category>
		<category><![CDATA[SoundTransform]]></category>
		<category><![CDATA[UIComponents]]></category>
		<category><![CDATA[URLRequest]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=769</guid>
		<description><![CDATA[
			
				
			
		
O exemplo abaixo, mostra como criar um player de música em actionscript 3.0 feito com alguns componentes básicos do Flash CS4, aquiles que vem por padrão no Flash CS3 e Flash CS4.
O projeto foi feito usando o Flex Builder, então procure nos arquevos do site como usar os componentes do Flash no Flex Builder.
Na atual [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D769"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D769&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>O exemplo abaixo, mostra como criar um player de música em actionscript 3.0 feito com alguns componentes básicos do Flash CS4, aquiles que vem por padrão no Flash CS3 e Flash CS4.<br />
O projeto foi feito usando o Flex Builder, então procure nos arquevos do site como usar os componentes do Flash no Flex Builder.</p>
<p>Na atual versão do actionscript 3.0 é bem complicado usar a classe de som, para se ter uma idéia, foi necessário usar as classes Sound, SoundChannel,SoundTransform, só para dar o play e controlar o volume.<br />
Em fim, segue abaixo o exemplo:</p>
<p><img src="http://www.igorcosta.com/blog/wp-content/uploads/2009/02/playermp3.jpg" alt="playermp3" title="playermp3" width="417" height="206" class="alignnone size-full wp-image-770" /></p>
<p><strong>Código:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> fl.controls.Button;
	<span style="color: #0033ff; font-weight: bold;">import</span> fl.controls.Slider;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span>.<span style="color: #004993;">URLRequest</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.media</span>.<span style="color: #004993;">Sound</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.media</span>.<span style="color: #004993;">SoundTransform</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.media</span>.<span style="color: #004993;">SoundChannel</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> fl.events.SliderEvent;
	<span style="color: #0033ff; font-weight: bold;">import</span> fl.controls.Label;
&nbsp;
	<span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;400&quot;</span>,<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;150&quot;</span>,<span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;0xF2F2F2&quot;</span>,<span style="color: #004993;">frameRate</span>=<span style="color: #990000;">&quot;25&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> AS3Player extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> playButton<span style="color: #000000; font-weight: bold;">:</span>Button;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> stopButton<span style="color: #000000; font-weight: bold;">:</span>Button;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> volumeControl<span style="color: #000000; font-weight: bold;">:</span>Slider;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> urlSom<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;mp3/seusom.mp3&quot;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> MP3Request<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLRequest</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> musicaTransform<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">SoundTransform</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> musicaCanal<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">SoundChannel</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> musica<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sound</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> volLabel<span style="color: #000000; font-weight: bold;">:</span>Label;
&nbsp;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AS3Player<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			MP3Request = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span>urlSom<span style="color: #000000;">&#41;</span>;
&nbsp;
			musica = <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>;
			musica.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>MP3Request<span style="color: #000000;">&#41;</span>;
			musicaCanal = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">SoundChannel</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			musicaTransform = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">SoundTransform</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0.5</span>,<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
&nbsp;
&nbsp;
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Montar os botões e Slider para controlar o som
			 * 
			 * playButton - Toca o som;
			 * stopButton - Para o som;
			 * volumeControl - Aumenta e diminue o som;
			 * */</span>
&nbsp;
			playButton = <span style="color: #0033ff; font-weight: bold;">new</span> Button<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			playButton.label = <span style="color: #990000;">&quot;Tocar&quot;</span>;
			playButton.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span>;
			playButton.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">20</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>playButton<span style="color: #000000;">&#41;</span>;
			playButton.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,SomAction<span style="color: #000000;">&#41;</span>;
&nbsp;
			stopButton = <span style="color: #0033ff; font-weight: bold;">new</span> Button<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			stopButton.label = <span style="color: #990000;">&quot;Parar&quot;</span>;
			stopButton.<span style="color: #004993;">x</span> = playButton.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">20</span>;
			stopButton.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">20</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>stopButton<span style="color: #000000;">&#41;</span>;
			stopButton.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,SomAction<span style="color: #000000;">&#41;</span>;
&nbsp;
			volumeControl = <span style="color: #0033ff; font-weight: bold;">new</span> Slider<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			volumeControl.direction = <span style="color: #990000;">&quot;horizontal&quot;</span><span style="color: #009900;">// ou vertical;</span>
			volumeControl.minimum =<span style="color: #000000; font-weight:bold;">0</span>;
			volumeControl.maximum =<span style="color: #000000; font-weight:bold;">1</span>;
			volumeControl.<span style="color: #004993;">doubleClickEnabled</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
			volumeControl.tickInterval = .1;
			volumeControl.snapInterval = .1;
			volumeControl.<span style="color: #004993;">value</span> = musicaTransform.<span style="color: #004993;">volume</span>;
			volumeControl.liveDragging = <span style="color: #0033ff; font-weight: bold;">true</span>;
			volumeControl.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">230</span>;
			volumeControl.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">20</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>volumeControl<span style="color: #000000;">&#41;</span>;	
			volumeControl.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>SliderEvent.<span style="color: #004993;">CHANGE</span>,VolumeAction<span style="color: #000000;">&#41;</span>;	
&nbsp;
			volLabel = <span style="color: #0033ff; font-weight: bold;">new</span> Label<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			volLabel.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Volume&quot;</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>volLabel<span style="color: #000000;">&#41;</span>;
			volLabel.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">250</span>;
			volLabel.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">40</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @public
		 * Controla o volume da música carregada;
		 * */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> VolumeAction<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span>SliderEvent<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
				musicaTransform.<span style="color: #004993;">volume</span> = volumeControl.<span style="color: #004993;">value</span>;
				musicaCanal.<span style="color: #004993;">soundTransform</span> = musicaTransform;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @public
		 * controla o som, play e stop;
		 * */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> SomAction<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
&nbsp;
				<span style="color: #6699cc; font-weight: bold;">var</span> posicao<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = musicaCanal.<span style="color: #004993;">position</span>;
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>playButton.label == <span style="color: #990000;">&quot;Tocar&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
					playButton.label = <span style="color: #990000;">&quot;Pausa&quot;</span>;
					musicaCanal = musica.<span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span>posicao<span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
					musicaCanal.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
					playButton.label = <span style="color: #990000;">&quot;Tocar&quot;</span>;
					musicaCanal.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=769</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Trabalhando com DataProvider no Flash CS3/CS4</title>
		<link>http://www.igorcosta.com/blog/?p=766</link>
		<comments>http://www.igorcosta.com/blog/?p=766#comments</comments>
		<pubDate>Sat, 07 Feb 2009 04:34:37 +0000</pubDate>
		<dc:creator>Igor Costa</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Actionscript Frameworks]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[ComboBox]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Flash CS3]]></category>

		<guid isPermaLink="false">http://www.igorcosta.com/blog/?p=766</guid>
		<description><![CDATA[
			
				
			
		
A sintaxe de programação para se trabalhar com DataProvider no Flash CS3 ou CS4 é um pouco diferente da que estamos acostumados no Flex. Entretanto o funcionamento é o mesmo. 
O exemplo abaixo, popula um controle de ComboBox, e foi feito com Document Class, caso você queria setar um para rodar em sua máquena.
A primeira [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D766"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.igorcosta.com%2Fblog%2F%3Fp%3D766&amp;source=igorcosta&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>A sintaxe de programação para se trabalhar com DataProvider no Flash CS3 ou CS4 é um pouco diferente da que estamos acostumados no Flex. Entretanto o funcionamento é o mesmo. </p>
<p>O exemplo abaixo, popula um controle de ComboBox, e foi feito com Document Class, caso você queria setar um para rodar em sua máquena.</p>
<p>A primeira coisa que você faz para adicionar dados ao seu controle é justamente criar um objeto DataProvider e setar o source dele para o Array, XML ou coleção de objetos que você tenha. Ele parece muito com o comportamento do ICollectionView do Flex.</p>
<p>Exemplo:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span><span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">import</span> fl.controls.ComboBox;
		<span style="color: #0033ff; font-weight: bold;">import</span> fl.<span style="color: #004993;">data</span>.DataProvider;
		<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">MovieClip</span>;
		<span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;800&quot;</span>,<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;600&quot;</span>, <span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;0xcccccc&quot;</span>, <span style="color: #004993;">frameRate</span>=<span style="color: #990000;">'40'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main extends <span style="color: #004993;">MovieClip</span> <span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> cbx<span style="color: #000000; font-weight: bold;">:</span>ComboBox;
			<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> arr<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">'Sao Paulo'</span>,<span style="color: #990000;">'Recife'</span>,<span style="color: #990000;">'Rio de Janeiro'</span>,<span style="color: #990000;">'Brasilia'</span><span style="color: #000000;">&#93;</span>;
			<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">d</span><span style="color: #000000; font-weight: bold;">:</span>DataProvider = <span style="color: #0033ff; font-weight: bold;">new</span> DataProvider<span style="color: #000000;">&#40;</span>arr<span style="color: #000000;">&#41;</span>;
					cbx = <span style="color: #0033ff; font-weight: bold;">new</span> ComboBox<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
					cbx.dataProvider = <span style="color: #004993;">d</span>;
					<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>cbx<span style="color: #000000;">&#41;</span>;
					cbx.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">100</span>;
					cbx.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">100</span>;
					cbx.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">CHANGE</span>,selecionado<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> selecionado<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.selectedItem.<span style="color: #004993;">data</span>.<span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.igorcosta.com/blog/?feed=rss2&amp;p=766</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
