<?xml version="1.0" encoding="ISO-8859-1"?>
<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>DClick Team Weblog [pt]</title>
	<atom:link href="http://blog.dclick.com.br/feed/pt/" rel="self" type="application/rss+xml" />
	<link>http://blog.dclick.com.br</link>
	<description>Blog do time da DClick</description>
	<lastBuildDate>Thu, 26 Aug 2010 14:17:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>pt</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Problema de foco com Flash/Flex no Firefox</title>
		<link>http://blog.dclick.com.br/2010/08/26/problema-de-foco-com-flashflex-no-firefox/pt/</link>
		<comments>http://blog.dclick.com.br/2010/08/26/problema-de-foco-com-flashflex-no-firefox/pt/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 14:17:28 +0000</pubDate>
		<dc:creator>André Gil</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2637</guid>
		<description><![CDATA[Twitter! Estou trabalhando em um projeto atualmente em que o cliente solicitou que o aplicativo pudesse ser controlado por teclas de atalho. Elas funcionam perfeitamente no Google Chrome e no IE mas, por algum motivo, o Firefox não trabalha muito bem com o foco em objetos "embedados" as vezes.
Depois de muitos testes, encontrei uma maneira [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Problema%20de%20foco%20com%20Flash%2FFlex%20no%20Firefox%22%20http%3A%2F%2Ftinyurl.com%2F2fzjujv" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Estou trabalhando em um projeto atualmente em que o cliente solicitou que o aplicativo pudesse ser controlado por teclas de atalho. Elas funcionam perfeitamente no Google Chrome e no IE mas, por algum motivo, o Firefox não trabalha muito bem com o foco em objetos "embedados" as vezes.</p>
<p>Depois de muitos testes, encontrei uma maneira bem simples de "resolver" esse problema. Primeiro você precisa abrir sua aplicação em algum navegador e olhar o código fonte de página. Procure pela tag <em>&lt;object&gt;</em> e olhe o valor do atributo <em>"id"</em> dela. Se você estiver no Flex usando o template padrão, esse valor deverá ser o nome da sua Application. No meu caso esse valor é <em>"index"</em>. Então escrevi essa linha em JavaScript para colocar o foco novamente no Flash:<br />
</p>
<div class="igBar"><span id="ljavascript-3"><a href="#" onclick="javascript:showPlainTxt('javascript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-3">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'index'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para usar esse código em sua aplicação Flex sem precisar mudar nada no template, faça:</p>
<div class="igBar"><span id="lactionscript-4"><a href="#" onclick="javascript:showPlainTxt('actionscript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
<div id="actionscript-4">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">navigateToURL<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"javascript:try{ document.getElementById('index').focus(); void(0); }catch(err){}"</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">"_self"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">algumComponente.<span style="color: #0066CC;">setFocus</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Funcionará melhor se você tentar encontrar onde sua aplicação está perdendo o foco (ao abrir alguma popup, no meu caso) e colocar o código logo em seguida. Usei um <em>try/catch</em> para evitar problemas, como no caso do usuário abrir o SWF diretamente.</p>
<p>Espero que seja útil,<br />
Abraços!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/08/26/problema-de-foco-com-flashflex-no-firefox/pt/feed/pt/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como desenvolver e debugar Flex no Google Chrome</title>
		<link>http://blog.dclick.com.br/2010/05/10/como-desenvolver-e-debugar-flex-no-google-chrome/pt/</link>
		<comments>http://blog.dclick.com.br/2010/05/10/como-desenvolver-e-debugar-flex-no-google-chrome/pt/#comments</comments>
		<pubDate>Tue, 11 May 2010 00:44:31 +0000</pubDate>
		<dc:creator>André Gil</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2594</guid>
		<description><![CDATA[Twitter! Desenvolver e debugar aplicações Flex no Google Chrome as vezes pode dar um pouco de dor de cabeça. Por isso, vou mostrar para vocês como resolver alguns dos problemas mais comuns.
Configurando o Eclipse

Primeiro você deve configurar o Eclipse. Abra Preferences &#62; General &#62; Web Browser e selecione "Use external Web Browser". Então, clique em [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Como%20desenvolver%20e%20debugar%20Flex%20no%20Google%20Chrome%22%20http%3A%2F%2Ftinyurl.com%2F28qeggu" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Desenvolver e debugar aplicações Flex no Google Chrome as vezes pode dar um pouco de dor de cabeça. Por isso, vou mostrar para vocês como resolver alguns dos problemas mais comuns.<br/><br/></p>
<h2>Configurando o Eclipse</h2>
<p><br/></p>
<p>Primeiro você deve configurar o Eclipse. Abra <strong>Preferences &gt; General &gt; Web Browser</strong> e selecione "Use external Web Browser". Então, clique em "New" e adicione "Google Chrome" usando a seguinte "Location":</p>
<p><code>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</code></p>
<p>Suas configurações deverão ficar assim:<br/><br/></p>
<p><a href="http://blog.dclick.com.br/wp-content/uploads/eclipse_config.png"><img src="http://blog.dclick.com.br/wp-content/uploads/eclipse_config.png" alt="" title="Configurando o Eclipse" width="497" height="412" class="aligncenter size-full wp-image-2600" /></a></p>
<p>Se estiver usando o Windows, você deverá clicar em "Browse..." e encontrar o arquivo .EXE do Google Chrome, no local onde foi instalado.<br/><br/></p>
<h2>Debug Flash Player</h2>
<p><br/></p>
<p>O Chrome tem seu próprio Flash Player, então mesmo se você instalar a versão de debug, pode ser que ela não seja usada pelo Chrome. Então primeiro, se você não tem o Player de debug, <a href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">baixe ele</a>. </p>
<p>Se você já instalou e reiniciou o Chrome, entre nesse endereço:</p>
<p><code>about:plugins</code></p>
<p>Se você reparar, vai ter duas versões do Flash Player instaladas. Uma delas, vai estar dentro das pastas do Chrome, e essa versão você deverá desativar. Mantenha a que você acabou de instalar. Vai ficar assim:<br/><br/></p>
<p><a href="http://blog.dclick.com.br/wp-content/uploads/chrome_plugins.png"><img src="http://blog.dclick.com.br/wp-content/uploads/chrome_plugins.png" alt="" title="Plugins do Chrome" width="550" height="263" class="aligncenter size-full wp-image-2603" /></a></p>
<p><strong>Update:</strong> Se você não conseguir desativar seus plugins, baixe o Chrome na <a href="http://www.google.com/chrome/eula.html?extra=devchannel" target="_blank">versão de desenvolvimento aqui</a>. </p>
<p>Depois disso, clique com o botão direito sobre o Flash de qualquer site e veja se você tem a opção "Show Redraw Regions". Se tiver, você já está usando o player de debug.<br/><br/></p>
<h2>Problemas com Cache</h2>
<p><br/></p>
<p>Se ficar atualizando a aplicação o tempo todo, você pode ter problemas com o cache do Chrome. Como acho que não existe uma opção fácil para desativar o cache, criei um aplicativo para Mac que vai iniciar o Chrome com alguns parâmetros para remover o cache temporariamente.</p>
<p>Para usar, <a href="http://labs.andregil.net/chrome_no_cache.zip">baixe o aplicativo</a>, descompacte, e mova para a pasta Applications do Mac. Se quiser, você pode arrastar depois o app para o Dock do Mac para ter acesso rápido a ele:<br/><br/></p>
<p><a href="http://blog.dclick.com.br/wp-content/uploads/dock.png"><img src="http://blog.dclick.com.br/wp-content/uploads/dock.png" alt="" title="Dock do Mac" width="550" height="132" class="aligncenter size-full wp-image-2604" /></a></p>
<p>Como o Chrome mantém uma instância inicial, você deverá iniciar ele pelo meu aplicativo caso não queira o Cache. Se você executar depois de já ter iniciado o Chrome, ele ainda vai manter o cache. Para ativar o cache novamente, basta fechar tudo e iniciar pelo link normal do Chrome.</p>
<p>Para usuários do Windows, basta copiar o atalho do Chrome, clicar com o botão direito na cópia, ir em "Propriedades" e adicionar esses parâmetros na linha de comando:</p>
<p><code>--disk-cache-size=1 --media-cache-size=1</code></p>
<p>O <a href="http://greasybacon.deviantart.com/art/Google-Chrome-Icon-Black-103895394" target="_blank">ícon preto do Chrome</a> foi criado por GreasyBacon. Não deixe de <a href="http://greasybacon.deviantart.com/" target="_blank">conhecer os outros trabalhos dele</a>.<br/><br/></p>
<h2>Conclusão</h2>
<p><br/></p>
<p>É isso! O único problema que ainda tenho é ao usar a opção "Find in Language Reference". Se descobrir como resolver, atualizarei o post. Se você descobrir algo, não esqueça de deixar nos comentários.</p>
<p>Abraços!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/05/10/como-desenvolver-e-debugar-flex-no-google-chrome/pt/feed/pt/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A DClick apresenta o Agon</title>
		<link>http://blog.dclick.com.br/2010/04/22/a-dclick-apresenta-o-agon/pt/</link>
		<comments>http://blog.dclick.com.br/2010/04/22/a-dclick-apresenta-o-agon/pt/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 15:52:38 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Notícias]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2575</guid>
		<description><![CDATA[Twitter! Hoje a DClick é muito conhecida por causa do Blog. O Twitter também já é o que mais trás acesso para o nosso site. Sempre quisemos que as pessoas postassem mais, fizessem mais Screencasts e, principalmente, compartilhassem com os demais as coisas maravilhosas que criam. Por isso criamos o Agon. Uma maneira de estimular [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22A%20DClick%20apresenta%20o%20Agon%22%20http%3A%2F%2Ftinyurl.com%2F2a4rykw" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Hoje a DClick é muito conhecida por causa do Blog. O Twitter também já é o que mais trás acesso para o nosso site. Sempre quisemos que as pessoas postassem mais, fizessem mais Screencasts e, principalmente, compartilhassem com os demais as coisas maravilhosas que criam. Por isso criamos o Agon. Uma maneira de estimular a recompensar as pessoas por agregarem valor à Empresa ao mesmo tempo em que desenvolvem grandes soluções para os nossos clientes.</p>
<p><embed src="http://blip.tv/play/gs05gdiUYwI" type="application/x-shockwave-flash" width="540" height="335" allowscriptaccess="always" allowfullscreen="true"></embed> </p>
<p>Não posso deixar de mencionar o Eduardo Horvath (Designer Digital) e o Leonardo Manopeli (Arquiteto de Informação) que até aqui estão entre os que mais contribuíram com  o desenvolvimento da versão "Alpha" do Agon e ao Rafael Martinelli e Rogério Martinelli, sócios fundadores da DClick, que deram todo apoio para este projeto interno. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/04/22/a-dclick-apresenta-o-agon/pt/feed/pt/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Processo Seletivo Estagiários 2010</title>
		<link>http://blog.dclick.com.br/2010/04/20/processo-seletivo-estagiarios-2010/pt/</link>
		<comments>http://blog.dclick.com.br/2010/04/20/processo-seletivo-estagiarios-2010/pt/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 13:24:07 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Notícias]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2566</guid>
		<description><![CDATA[Twitter! A DClick está iniciando um processo seletivo para estagiários. O candidato deve dominar as seguintes tecnologias:
NDS 3.0, VA 4.0, POP 4.0, AOSP 5.0.
Se você não entendeu nada desta sopa de letrinhas não se preocupe. Aqui vai uma descrição detalhada do que você deve dominar para ter boas chances de garantir uma vaga no nosso [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Processo%20Seletivo%20Estagi%E1rios%202010%22%20http%3A%2F%2Ftinyurl.com%2Fy78rbbu" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>A DClick está iniciando um processo seletivo para estagiários. O candidato deve dominar as seguintes tecnologias:</p>
<p><strong>NDS 3.0, VA 4.0, POP 4.0, AOSP 5.0.</strong></p>
<p>Se você não entendeu nada desta sopa de letrinhas não se preocupe. Aqui vai uma descrição detalhada do que você deve dominar para ter boas chances de garantir uma vaga no nosso processo seletivo:</p>
<p><strong>NDS 3.0</strong>: Noções de Desenvolvimento de Software<br />
<strong>VA 4.0</strong>: Vontade de Aprender<br />
<strong>POP 4.0</strong>: Proatividade Orientada à Pesquisa<br />
<strong>AOSP 5.0</strong>: Autodidata Orientado a Soluções de Problemas</p>
<p>Ao contrário das siglas de TI os números não se referem as versões e sim ao peso que cada característica terá neste processo seletivo. </p>
<p>É desejável que o candidato esteja cursando alguma faculdade relacionada a Desenvolvimento de Software, mas isto não é impeditivo desde que o candidato domine o NDS 3.0.</p>
<p>Ah... o que você irá fazer? Veja este vídeo:<br />
<embed src="http://blip.tv/play/AerDepLlEg" type="application/x-shockwave-flash" width="540" height="315" allowscriptaccess="always" allowfullscreen="true"></embed> </p>
<p>Os interessados devem enviar um currículo para: oportunidade@dclick.com.br</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/04/20/processo-seletivo-estagiarios-2010/pt/feed/pt/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Mário Júnior, bem vindo ao DClick Team!</title>
		<link>http://blog.dclick.com.br/2010/04/20/dclick-recruta-mario-junior/pt/</link>
		<comments>http://blog.dclick.com.br/2010/04/20/dclick-recruta-mario-junior/pt/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 12:55:47 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Notícias]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2561</guid>
		<description><![CDATA[Twitter! Quem trabalha com Flex e participa da comunidade deve saber quem é Mário Júnior. Seja na FlexDev, no seu blog, ou em apresentações (BlazeDS: Integrando Java e Flex Facilmente) e treinamentos pela Web ele já mostrou sua competência no desenvolvimento de Rich Internet Applications. 
Agora chegou a hora do Mário Jr. colaborar com o [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22M%E1rio%20J%FAnior%2C%20bem%20vindo%20ao%20DClick%20Team%21%22%20http%3A%2F%2Ftinyurl.com%2Fy7k4ts6" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Quem trabalha com Flex e participa da comunidade deve saber quem é <a href="http://www.mariojunior.com/">Mário Júnior</a>. Seja na <a href="http://groups.google.com/group/flexdev/about?hl=pt-BR">FlexDev</a>, no seu <a href="http://www.mariojunior.com">blog</a>, ou em apresentações (<a href="http://www.tomsas.com.br/cafecomtom/10_BlazeDSComMarioJunior.mov.zip">BlazeDS: Integrando Java e Flex Facilmente</a>) e treinamentos pela Web ele já mostrou sua competência no desenvolvimento de Rich Internet Applications. </p>
<p>Agora chegou a hora do Mário Jr. colaborar com o DClick Team. Desde ontem ele trabalha para a DClick na unidade do Rio de Janeiro. </p>
<p>Mário Júnior, em nome de todo o time da DClick desejo-lhe boa sorte. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/04/20/dclick-recruta-mario-junior/pt/feed/pt/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Groovy XmlSlurper &amp; invokeMethod</title>
		<link>http://blog.dclick.com.br/2010/03/30/groovy-xmlslurper-invokemethod/pt/</link>
		<comments>http://blog.dclick.com.br/2010/03/30/groovy-xmlslurper-invokemethod/pt/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 16:54:44 +0000</pubDate>
		<dc:creator>Bruno Fuster</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Groovy]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2541</guid>
		<description><![CDATA[Twitter! Grande parte do dinamismo do groovy se deve ao invokeMethod. Quando declarado, este método será executado caso um método inexistente for chamado no objeto em questão (Method missing no Ruby ou Python).
"invokeMethod(String name, Object args) is at the heart of Groovy metaprogramming.", Groovy Recipes

Vamos ao exemplo:
PLAIN TEXT
CODE:




class Sample &#123;


&#160; &#160; Object invokeMethod&#40; String name, [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Groovy%20XmlSlurper%20%26%20invokeMethod%22%20http%3A%2F%2Ftinyurl.com%2Fyk7fxn5" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Grande parte do dinamismo do <a href="http://groovy.codehaus.org/">groovy</a> se deve ao <a href="http://groovy.codehaus.org/Using+invokeMethod+and+getProperty">invokeMethod</a>. Quando declarado, este método será executado caso um método inexistente for chamado no objeto em questão (Method missing no Ruby ou Python).</p>
<p><em>"invokeMethod(String name, Object args) is at the heart of Groovy metaprogramming."</em>, <a href="http://www.amazon.com/Groovy-Recipes-Greasing-Pragmatic-Programmers/dp/0978739299/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1269988879&#038;sr=8-1">Groovy Recipes</a></p>
<p><span id="more-2541"></span></p>
<p>Vamos ao exemplo:</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class Sample <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Object invokeMethod<span style="color:#006600; font-weight:bold;">&#40;</span> String name, Object params <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; println <span style="color:#CC0000;">"method ${name} with params ${params}"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Podemos agora chamar qualquer método em um objeto Sample:</p>
<div class="igBar"><span id="lcode-11"><a href="#" onclick="javascript:showPlainTxt('code-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-11">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">def sample = new Sample<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sample.<span style="">anything</span> <span style="color:#CC0000;">"arg1"</span>, <span style="color:#CC0000;">"arg2"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>E devido ao "method missing" do groovy, podemos navegar em um XML de forma elegante usando o <a href="http://groovy.codehaus.org/api/groovy/util/XmlSlurper.html">XmlSlurper</a> (navegação semelhante ao <a href="http://en.wikipedia.org/wiki/ECMAScript_for_XML">E4X</a>):</p>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showPlainTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">def xml = <span style="color:#CC0000;">""</span><span style="color:#CC0000;">"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&lt;users&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &lt;user id="</span>1<span style="color:#CC0000;">"&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;name&gt;Bruno&lt;/name&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;email&gt;bruno.fuster@dclick.com.br&lt;/email&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &lt;/user&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &lt;user id="</span>2<span style="color:#CC0000;">"&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;name&gt;Fuster&lt;/name&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;email&gt;bruno.fuster@dclick.com.br&lt;/email&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&nbsp; &nbsp; &lt;/user&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">&lt;/users&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">"</span><span style="color:#CC0000;">""</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">def users = new XmlSlurper<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">parseText</span><span style="color:#006600; font-weight:bold;">&#40;</span>xml<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//para cada user no xml</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">users.<span style="">user</span>.<span style="">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> user -&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="">println</span> user.@id </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; println user.<span style="">name</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>No código acima estamos acessando os elementos do XML através de um método ou atributo inexistente (users.user, user.name, user.@id), o que seria impossível sem <a href="http://groovy.codehaus.org/Using+invokeMethod+and+getProperty">invokeMethod e getProperty</a> usado pelo XmlSlurper em conjunto com <a href="http://groovy.codehaus.org/GPath">GPath</a>.</p>
<p>Também poderiamos utilizar bibliotecas Java (XStream, JDOM, etc) para serializar objetos para XML e vice-versa, mas vamos brincar com groovy agora para obter uma lista de objetos do xml acima:</p>
<div class="igBar"><span id="lcode-13"><a href="#" onclick="javascript:showPlainTxt('code-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-13">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">def objects = users.<span style="">user</span>.<span style="">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> xmlUser -&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="">new</span> User<span style="color:#006600; font-weight:bold;">&#40;</span>id: xmlUser.@id, name: xmlUser.<span style="">name</span>, email: xmlUser.<span style="">email</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>E serializar objetos para XML/JSON fica fácil com <a href="http://grails.org/Converters+Reference">grails.converters</a> e <a href="http://www.grails.org/doc/latest/guide/single.html#6.8%20Content%20Negotiation">content negotiation</a>:</p>
<div class="igBar"><span id="lcode-14"><a href="#" onclick="javascript:showPlainTxt('code-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-14">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import grails.<span style="">converters</span>.*</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ...</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="">def</span> list = <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; withFormat <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xml<span style="color:#006600; font-weight:bold;">&#40;</span>contentType:<span style="color:#CC0000;">"text/xml"</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; render User.<span style="">list</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> as XML </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json<span style="color:#006600; font-weight:bold;">&#40;</span>contentType:<span style="color:#CC0000;">"text/json"</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; render User.<span style="">list</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> as JSON</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ... </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Produtivo, não ?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/03/30/groovy-xmlslurper-invokemethod/pt/feed/pt/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Evitando problemas com Views e DTOs</title>
		<link>http://blog.dclick.com.br/2010/03/04/evitando-problemas-com-views-e-dtos/pt/</link>
		<comments>http://blog.dclick.com.br/2010/03/04/evitando-problemas-com-views-e-dtos/pt/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 12:42:56 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Flex Components]]></category>
		<category><![CDATA[Screencast]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2482</guid>
		<description><![CDATA[Twitter! No seu aplicativo você tem um DTO cujo os dados são renderizados por diferentes Views (telas). Então, toda hora que o seu DTO muda, você percebe sua aplicação travada por uns segundos. Depois de um tempo você percebe que o problema é que mesmo as telas que estão invisíveis estão executando código de apresentação [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Evitando%20problemas%20com%20Views%20e%20DTOs%22%20http%3A%2F%2Ftinyurl.com%2Fyjav4df" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>No seu aplicativo você tem um DTO cujo os dados são renderizados por diferentes Views (telas). Então, toda hora que o seu DTO muda, você percebe sua aplicação travada por uns segundos. Depois de um tempo você percebe que o problema é que mesmo as telas que estão invisíveis estão executando código de apresentação de dados com base no novo DTO. Bem, este é um problema comum quando trabalhamos com DTOs complexos e abusamos do Data Binding. </p>
<p>A notícia ruim é que se você não teve este problema ainda, um dia você terá. A notícia boa é que uma das maneiras de evitar este problema é utilizar o DTOViewHelper, componente disponibilizado neste screencast. </p>
<p>Alguns Frameworks atuais do Flex oferecem maneiras de resolver este problema, mas o DTOViewHelper é independente do Framework que você usa. Além disso, como pode ser visto no Screencast, você pode definir métodos auxiliares dentro do DTOViewHelper com o objetivo compartilhar lógica de apresentação de dados de DTOs entre diferentes Views (veja o exemplo da Data que mostra a string "Hoje" no Screencast).</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="370" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"><param name="src" value="http://blip.tv/play/gs05gcq0KgI" /><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><embed type="application/x-shockwave-flash" width="540" height="370" src="http://blip.tv/play/gs05gcq0KgI" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://www.becklog.org/wp-content/uploads/2010/PopulandoTodasViews.zip">Clique aqui</a> para fazer o download do código fonte do exemplo "errado" (I could be WRONG).</p>
<p><a href="http://www.becklog.org/wp-content/uploads/2010/PopulandoViewsVisiveis.zip">Clique aqui</a> para fazer o download do código fonte do exemplo "certo" (I could be RIGHT).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/03/04/evitando-problemas-com-views-e-dtos/pt/feed/pt/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Designer para Aplicações Hollywoodianas</title>
		<link>http://blog.dclick.com.br/2010/03/01/designer-para-aplicacoes-hollywoodianas/pt/</link>
		<comments>http://blog.dclick.com.br/2010/03/01/designer-para-aplicacoes-hollywoodianas/pt/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 12:57:50 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Notícias]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2470</guid>
		<description><![CDATA[Twitter! A DClick SP esta em busca um Designer para seus aplicativos RIA. Os interessados devem enviar um currículo para oportunidade@dclick.com.br.
Mas deixa eu falar uma coisa: como é difícil encontrar Desginers que desejem trabalhar com aplicativos, não é verdade? 
Suponho que muitos Designers não querem trabalhar em empresas de TI por alguns motivos:
1. Os Designers [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Designer%20para%20Aplica%E7%F5es%20Hollywoodianas%22%20http%3A%2F%2Ftinyurl.com%2Fylsa7ax" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>A DClick SP esta em busca um Designer para seus aplicativos RIA. Os interessados devem enviar um currículo para oportunidade@dclick.com.br.</p>
<p>Mas deixa eu falar uma coisa: como é difícil encontrar Desginers que desejem trabalhar com aplicativos, não é verdade? </p>
<p>Suponho que muitos Designers não querem trabalhar em empresas de TI por alguns motivos:</p>
<p>1. Os Designers acreditam que numa grande agência de publicidade eles terão mais reconhecimento (só não devem se esquecer que numa agência talvez ele seja só mais um)</p>
<p>2. Os Designers acreditam que numa grande agência eles terão oportunidade de concorrer a prêmios (tá bom, deve ser legal, mas isso não vai mudar o mundo)</p>
<p>3. Os Designers acreditam que fora de uma agência seu trabalho não será valorizado, mas sim ridicularizado como geralmente acontece em empresas de TI que vêem este trabalho como algo supérfluo - para não dizer "frescura" (termo terminantemente proibido na DClick para avaliar um Design!)</p>
<p>Pois bem, exposto <del datetime="2010-03-01T13:34:42+00:00">o motivo</del> a opinião pela qual muitos Designers preferem agencias, agora deixa eu falar porque aqui na DClick será diferente:</p>
<p>1. Aqui na DClick você terá reconhecimento pois você será o responsável por aplicativos como <a href="http://blip.tv/file/3086747">este</a> e <a href="http://dclick.blip.tv/file/1736679">estes do teaser</a>. Você também estará trabalhando na maior empresa de RIA do Brasil e prestando serviços para clientes como Petrobras, Odebrecht, COC e possivelmente clientes do exterior.</p>
<p>2. Mas tudo isso do item 1, apesar de ser verdade, soa muito corporativo e num blog como este ninguém agüenta este dialeto dos negócios. Pois bem, trocando em miúdos, o principal motivo para você trabalhar aqui é mudar a maneira como as empresas de TI enxergam o Design de Aplicativos construindo cases que vão deixar o mundo de boca aberta. Aqui nós queremos desenvolver aplicações Hollywoodianas no sentido de "criação de grandes experiências" graças ao perfeito equilíbrio entre as diferentes expertises: design gráfico, design de interação, programação e negócios. E  nós acreditamos que isso pode mudar o mundo não apenas pelos aplicativos que acreditamos que somos capazes de desenvolver, mas também com as noções tais como a de que o Design é, como tudo, algo vivo no processo e não apenas o ato de colorir wireframes.</p>
<p>3. Você será peça fundamental na criação destas aplicações Hollywoodianas. Aqui a sua opinião será ouvida e ponderada. Não prevalecerá os paradigmas das empresas de TI que muitas vezes vetam uma boa idéia porque acham que vai ser difícil fazer. Temos técnicos altamente capacitados para tornar realidade o seu Design. O seu Design é um desafio para nós e não um problema irrelevante. </p>
<p>Pois bem, já vendi o peixe da empresa, agora cabe a você vender o seu. Ajuda muito se você se achar capaz de fazer Design como os dos screenshoots abaixo:</p>
<p><a href='http://blog.dclick.com.br/wp-content/uploads/screen1.png' title='Demo'><img src='http://blog.dclick.com.br/wp-content/uploads/screen1_small.png' alt='Demo' /></a></p>
<p><a href='http://blog.dclick.com.br/wp-content/uploads/screen2.png' title='Demo'><img src='http://blog.dclick.com.br/wp-content/uploads/screen2_small.png' alt='Demo' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/03/01/designer-para-aplicacoes-hollywoodianas/pt/feed/pt/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Rotacionando Janelas no Flex: PodFlip Component</title>
		<link>http://blog.dclick.com.br/2010/02/22/rotacionando-janelas-no-flex-podflip-component/pt/</link>
		<comments>http://blog.dclick.com.br/2010/02/22/rotacionando-janelas-no-flex-podflip-component/pt/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 13:56:04 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex Components]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2405</guid>
		<description><![CDATA[Twitter! A ultima turma do Imersão Adobe Flex recebeu alguns "presentinhos". Dentre eles o componente PodFlip, utilizado numa das aplicações que desenvolvemos aqui na DClick e que o pessoal já andou vendo por aí. 
É verdade que o Flex 4 e com as novas capacidades 3D do Flash Player isso será bem mais fácil no [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Rotacionando%20Janelas%20no%20Flex%3A%20PodFlip%20Component%22%20http%3A%2F%2Ftinyurl.com%2Fy8krr9p" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>A ultima turma do <a href="http://www.egenial.com.br/imersao-flex">Imersão Adobe Flex</a> recebeu alguns "presentinhos". Dentre eles o componente PodFlip, utilizado numa das aplicações que desenvolvemos aqui na DClick e que o pessoal já andou vendo por aí. </p>
<p>É verdade que o Flex 4 e com as novas capacidades 3D do Flash Player isso será bem mais fácil no futuro. Mas enquanto este dia não chega agora é a hora de compartilhar este componente com o restante de comunidade. Espero que seja util em algum projeto para vocês.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="370" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"><param name="src" value="http://blip.tv/play/gs0tgcbCEAA" /><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><embed type="application/x-shockwave-flash" width="540" height="370" src="http://blip.tv/play/gs05gcfPNAI" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://www.becklog.org/wp-content/uploads/2010/PodFlipUsage.zip">Clique aqui</a> para fazer o download do código fonte deste screencast.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/02/22/rotacionando-janelas-no-flex-podflip-component/pt/feed/pt/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Typesafe Enum em Action Script 3</title>
		<link>http://blog.dclick.com.br/2010/02/18/typesafe-enum-em-action-script-3/pt/</link>
		<comments>http://blog.dclick.com.br/2010/02/18/typesafe-enum-em-action-script-3/pt/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:23:48 +0000</pubDate>
		<dc:creator>Rafael Martinelli</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programação]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2431</guid>
		<description><![CDATA[Twitter! O screencast abaixo é bem simples, porém muito eficiente para proteger o seu código. É importante ressaltar que isso tudo é necessário, pois o Action Script 3 não possui construtor privado e muito menos a implementação nativa de Enum.

]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Typesafe%20Enum%20em%20Action%20Script%203%22%20http%3A%2F%2Ftinyurl.com%2Fyzzulrz" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>O screencast abaixo é bem simples, porém muito eficiente para proteger o seu código. É importante ressaltar que isso tudo é necessário, pois o Action Script 3 não possui construtor privado e muito menos a implementação nativa de Enum.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="370" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"><param name="src" value="http://blip.tv/play/gs0tgcbCEAA" /><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><embed type="application/x-shockwave-flash" width="540" height="370" src="http://blip.tv/play/gs0tgcbCEAA" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/02/18/typesafe-enum-em-action-script-3/pt/feed/pt/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Oportunidade para Trabalhar com RIA no RJ</title>
		<link>http://blog.dclick.com.br/2010/02/12/oportunidade-para-trabalhar-com-ria-no-rj/pt/</link>
		<comments>http://blog.dclick.com.br/2010/02/12/oportunidade-para-trabalhar-com-ria-no-rj/pt/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 10:47:48 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Notícias]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2420</guid>
		<description><![CDATA[Twitter! A DClick RJ está contratando programadores RIA para trabalhar no RJ. 
Se você conhece bem Adobe Flex suas chances são grandes. Senão, veja se você encaixa na filosofia abaixo.
 
Nota: Os dois últimos projetos do vídeo foram desenvolvidos pela em parceria com a Roundarch dos EUA.
Os interessados devem enviar um email para: oportunidade@dclick.com.br. Quem [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Oportunidade%20para%20Trabalhar%20com%20RIA%20no%20RJ%22%20http%3A%2F%2Ftinyurl.com%2Fyzjn9jw" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>A DClick RJ está contratando programadores RIA para trabalhar no RJ. </p>
<p>Se você conhece bem Adobe Flex suas chances são grandes. Senão, veja se você encaixa na filosofia abaixo.</p>
<p><embed src="http://blip.tv/play/AerDepLlEg" type="application/x-shockwave-flash" width="540" height="315" allowscriptaccess="always" allowfullscreen="true"></embed> </p>
<p>Nota: Os dois últimos projetos do vídeo foram desenvolvidos pela em parceria com a Roundarch dos EUA.</p>
<p>Os interessados devem enviar um email para: oportunidade@dclick.com.br. Quem sabe no próximo <a href="http://blog.dclick.com.br/2008/12/19/enfim-a-tal-surpresa-dclick-team-teaser/pt/">DClick Team Teaser</a> o seu nome não faça parte da lista que aparece no final do clipe. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/02/12/oportunidade-para-trabalhar-com-ria-no-rj/pt/feed/pt/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Uma palestra por R$3,00 e um sorriso que não se paga</title>
		<link>http://blog.dclick.com.br/2010/02/01/uma-palestra-por-r300-e-um-sorriso-que-nao-se-paga/pt/</link>
		<comments>http://blog.dclick.com.br/2010/02/01/uma-palestra-por-r300-e-um-sorriso-que-nao-se-paga/pt/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 11:54:23 +0000</pubDate>
		<dc:creator>Rubens Albuquerque</dc:creator>
				<category><![CDATA[(Sem Categoria)]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2407</guid>
		<description><![CDATA[Twitter! Uma palestra do Flex For Kids: R$ 3,00.
O evento Flex For Kids: R$ 30,00.
Ver o incrível vídeo do Flex For Kids. Apenas 3 minutos.
Ajudar uma criança a sorrir: Não tem preço.
]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Uma%20palestra%20por%20R%243%2C00%20e%20um%20sorriso%20que%20n%E3o%20se%20paga%22%20http%3A%2F%2Ftinyurl.com%2Fybjja9c" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Uma palestra do Flex For Kids: <strong>R$ 3,00</strong>.<br />
O evento Flex For Kids: <strong>R$ 30,00</strong>.<br />
Ver o <a href="http://www.flexforkids.com/site/institutional">incrível vídeo do Flex For Kids.</a> <strong>Apenas 3 minutos</strong>.<br />
<a href="http://www.flexforkids.com/site/favored">Ajudar uma criança a sorrir</a>: <strong>Não tem preço.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/02/01/uma-palestra-por-r300-e-um-sorriso-que-nao-se-paga/pt/feed/pt/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como pegar o BitmapData e o ByteArray de um Embed no Flex?</title>
		<link>http://blog.dclick.com.br/2010/01/28/como-pegar-o-bitmapdata-e-o-bytearray-de-um-embed-no-flex/pt/</link>
		<comments>http://blog.dclick.com.br/2010/01/28/como-pegar-o-bitmapdata-e-o-bytearray-de-um-embed-no-flex/pt/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 12:17:39 +0000</pubDate>
		<dc:creator>André Gil</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2397</guid>
		<description><![CDATA[Twitter! Quando você quer manipular imagens e outros tipos de arquivos no Flex, geralmente você precisa do BitmapData ou o ByteArray desse arquivo. A maioria das pessoas já sabe como fazer isso usando o Loader, mas é um pouco mais difícil encontrar informações sobre como fazer isso com arquivos "Embedados". Por isso, vou mostrar aqui [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Como%20pegar%20o%20BitmapData%20e%20o%20ByteArray%20de%20um%20Embed%20no%20Flex%3F%22%20http%3A%2F%2Ftinyurl.com%2Fyjyz3e9" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Quando você quer manipular imagens e outros tipos de arquivos no Flex, geralmente você precisa do BitmapData ou o ByteArray desse arquivo. A maioria das pessoas já sabe como fazer isso usando o Loader, mas é um pouco mais difícil encontrar informações sobre como fazer isso com arquivos "Embedados". Por isso, vou mostrar aqui como fazer!</p>
<p>Se você quer embedar uma imagem (JPEG, GIF ou PNG) no Flex, você precisa embedar em uma variável do tipo Class. O que a maioria das pessoas não sabe é que o tipo dessa classe será BitmapAsset e que BitmapAsset é uma subclasse da classe Bitmap. Então, você pode fazer isso:<br/><br/></p>
<div class="igBar"><span id="lactionscript-18"><a href="#" onclick="javascript:showPlainTxt('actionscript-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-18">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">"image.png"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> MyEmbed:<span style="color: #000000; font-weight: bold;">Class</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getBitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:BitmapData</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bitmapAsset:BitmapAsset = <span style="color: #000000; font-weight: bold;">new</span> MyEmbed<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> bitmapAsset.<span style="color: #006600;">bitmapData</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/>Agora, para pegar o ByteArray, você precisa de uma pequena alteração. Você deve adicionar o parâmetro <em>mimeType="application/octet-stream"</em> para a metadata Embed. Com esse parâmetro, a variável Class será do tipo ByteArrayAsset, que é uma subclasse do ByteArray. Então, você poderá fazer isso:<br/><br/></p>
<div class="igBar"><span id="lactionscript-19"><a href="#" onclick="javascript:showPlainTxt('actionscript-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-19">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">"image.png"</span>,mimeType=<span style="color: #ff0000;">"application/octet-stream"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> MyEmbed:<span style="color: #000000; font-weight: bold;">Class</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ByteArrayAsset</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> byteArrayAsset:ByteArrayAsset = <span style="color: #000000; font-weight: bold;">new</span> MyEmbed<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> byteArrayAsset;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/>Dessa maneira, você pode até usar o Embed em algum arquivo TXT ou XML para sua aplicação e lê-lo facilmente! O ByteArray pode ser convertido para String dessa maneira:<br/><br/></p>
<div class="igBar"><span id="lactionscript-20"><a href="#" onclick="javascript:showPlainTxt('actionscript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-20">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">"myTextFile.txt"</span>,mimeType=<span style="color: #ff0000;">"application/octet-stream"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> MyEmbed:<span style="color: #000000; font-weight: bold;">Class</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> readEmbeddedTxt<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> byteArrayAsset:ByteArrayAsset = <span style="color: #000000; font-weight: bold;">new</span> MyEmbed<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> byteArrayAsset.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/>Fácil, hein?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/01/28/como-pegar-o-bitmapdata-e-o-bytearray-de-um-embed-no-flex/pt/feed/pt/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex For Kids</title>
		<link>http://blog.dclick.com.br/2010/01/26/flex-for-kids/pt/</link>
		<comments>http://blog.dclick.com.br/2010/01/26/flex-for-kids/pt/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 10:43:46 +0000</pubDate>
		<dc:creator>Beck Novaes</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2395</guid>
		<description><![CDATA[Twitter! A DClick está patrocinando o Flex for Kids. Este é um evento muito especial para todos que trabalham não apenas com RIA, mas com desenvolvimento de Software em geral. Eu não preciso escrever muito neste post. Basta você clicar aqui e ver (sentir) o vídeo de menos de três minutos.
]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Flex%20For%20Kids%22%20http%3A%2F%2Ftinyurl.com%2Fylc267g" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>A DClick está patrocinando o Flex for Kids. Este é um evento muito especial para todos que trabalham não apenas com RIA, mas com desenvolvimento de Software em geral. Eu não preciso escrever muito neste post. Basta você <a href="http://www.flexforkids.com/site/institutional">clicar aqui</a> e ver (sentir) o vídeo de menos de três minutos.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/01/26/flex-for-kids/pt/feed/pt/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passando parâmetros para Event Handlers &#8211; Parte 2</title>
		<link>http://blog.dclick.com.br/2010/01/19/passando-parametros-para-event-handlers-parte-2/pt/</link>
		<comments>http://blog.dclick.com.br/2010/01/19/passando-parametros-para-event-handlers-parte-2/pt/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 11:01:01 +0000</pubDate>
		<dc:creator>André Gil</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Otimização]]></category>
		<category><![CDATA[Programação]]></category>

		<guid isPermaLink="false">http://blog.dclick.com.br/?p=2392</guid>
		<description><![CDATA[Twitter! Ano passasdo perguntei ao Beck como passar parâmetros para Event Handlers adicionados dinamicamente, porque quando você adiciona Event Listener usando myComp.addEventListener(...), o handler deve esperar apenas o parâmetro do evento. O Beck deu uma solução para isso, mas deixou claro que é apenas uma solução "alternativa", não a melhor delas.
Alguns dias atrás eu estava [...]]]></description>
			<content:encoded><![CDATA[<span class="post-twitter" ><a href="http://twitter.com/home?status=DClick%20Post%3A%20%20%22Passando%20par%E2metros%20para%20Event%20Handlers%20-%20Parte%202%22%20http%3A%2F%2Ftinyurl.com%2Fydgb6p6" title="Twitter! <br /><br />" rel="nofollow">Twitter! <br /><br /></a></span><p>Ano passasdo perguntei ao <a href="http://www.becklog.org/" target="_blank">Beck</a> como passar parâmetros para Event Handlers adicionados dinamicamente, porque quando você adiciona Event Listener usando <em>myComp.addEventListener(...)</em>, o handler deve esperar apenas o parâmetro do evento. O Beck <a href="http://blog.dclick.com.br/2007/11/29/passando-parametros-para-event-handlers-alem-do-event/pt/" target="_blank">deu uma solução</a> para isso, mas deixou claro que é apenas uma solução "alternativa", não a melhor delas.</p>
<p>Alguns dias atrás eu estava trabalhando com requisições simultâneas para o servidor e queria guardar o parâmetro da chamada, mas não queria ter que retornar ele do Java, então pensei em uma outra solução para isso. Considerando que seu Event Handler está esperando uma Function que tem somente um parâmetro Event, eu criei uma outra Function que retorna uma Function esperando um parâmetro Event. Mas o segredo é que o escopo de Function Closure permite que você acesse parâmetros tanto da primeira quanto da segunda Function, então você pode fazer isso:<br/><br/></p>
<div class="igBar"><span id="lxml-24"><a href="#" onclick="javascript:showPlainTxt('xml-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-24">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Application xmlns:<span style="color: #000066;">mx</span>=<span style="color: #ff0000;">"http://www.adobe.com/2006/mxml"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"100%"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"100%"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066;">initialize</span>=<span style="color: #ff0000;">"initApp()"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Script<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;![CDATA[</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private function initApp():void</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttonA.addEventListener(MouseEvent.CLICK, buttonHandler(0x0000FF));</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buttonB.addEventListener(MouseEvent.CLICK, buttonHandler(0xFF0000));</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; private function buttonHandler(color:uint):Function</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return function(event:MouseEvent):void</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; box.setStyle(&quot;backgroundColor&quot;, color);</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ]]&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx</span>:Script<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:HBox<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Button <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"buttonA"</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">"Blue"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Button <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"buttonB"</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">"Red"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx</span>:HBox<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Box <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"box"</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">"80"</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">"200"</span> <span style="color: #000066;">backgroundColor</span>=<span style="color: #ff0000;">"#FFFFFF"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/mx</span>:Application<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/>Mas e agora se você quiser usar esse Event Handler diretamente no MXML? Bem, você <strong>não</strong> pode fazer isso:<br/><br/></p>
<div class="igBar"><span id="lxml-25"><a href="#" onclick="javascript:showPlainTxt('xml-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-25">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Button <span style="color: #000066;">label</span>=<span style="color: #ff0000;">"Green"</span> <span style="color: #000066;">click</span>=<span style="color: #ff0000;">"buttonHandler(0x00FF00)"</span><span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/>Isso não vai funcionar porque a Function que retorna da primeira Function está esperando um parâmetro Event. Então, você pode fazer assim:<br/><br/></p>
<div class="igBar"><span id="lxml-26"><a href="#" onclick="javascript:showPlainTxt('xml-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-26">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;mx</span>:Button <span style="color: #000066;">label</span>=<span style="color: #ff0000;">"Green"</span> <span style="color: #000066;">click</span>=<span style="color: #ff0000;">"buttonHandler(0x00FF00)(event)"</span><span style="font-weight: bold; color: black;">/&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/>Estranho, não? Talvez mais um patter do <a href="http://blog.dclick.com.br/2007/02/02/freaktionscript/pt/" target="_blank">FreaktionScript</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dclick.com.br/2010/01/19/passando-parametros-para-event-handlers-parte-2/pt/feed/pt/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
