<?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>Herberth Amaral &#187; flex</title> <atom:link href="http://herberthamaral.com/tag/flex/feed/" rel="self" type="application/rss+xml" /><link>http://herberthamaral.com</link> <description>Software development adventures</description> <lastBuildDate>Thu, 26 Aug 2010 13:59:42 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>Dica rapida: Usando ActionScript em expressoes de DataBinding para alinhar elementos na tela</title><link>http://herberthamaral.com/2010/05/dica-rapida-usando-actionscript-em-expressoes-de-databinding-para-alinhar-elementos-na-tela/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=dica-rapida-usando-actionscript-em-expressoes-de-databinding-para-alinhar-elementos-na-tela</link> <comments>http://herberthamaral.com/2010/05/dica-rapida-usando-actionscript-em-expressoes-de-databinding-para-alinhar-elementos-na-tela/#comments</comments> <pubDate>Fri, 14 May 2010 15:30:46 +0000</pubDate> <dc:creator>Herberth Amaral</dc:creator> <category><![CDATA[Flash]]></category> <category><![CDATA[Flex & Actionscript]]></category> <category><![CDATA[actionscript]]></category> <category><![CDATA[dica]]></category> <category><![CDATA[flex]]></category><guid isPermaLink="false">http://herberthamaral.com/?p=423</guid> <description><![CDATA[Vamos ao ponto: &#60;mx :Label id=&#34;meuLabel&#34; x=&#34;{Application.application.width/2 - meuLabel.width/2}&#34; y=&#34;{Application.application.height/2 - meuLabel.height/2}&#34; /&#62; O que o código acima faz é manter um label exatamente no centro da tela. Pra isso, ele coloca o seu X na metade da largura da tela menos a metade da própria largura. O mesmo acontece para o Y. Ainda dá [...]]]></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%2Fherberthamaral.com%2F2010%2F05%2Fdica-rapida-usando-actionscript-em-expressoes-de-databinding-para-alinhar-elementos-na-tela%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fherberthamaral.com%2F2010%2F05%2Fdica-rapida-usando-actionscript-em-expressoes-de-databinding-para-alinhar-elementos-na-tela%2F&amp;source=HerberthAmaral&amp;style=normal" height="61" width="50" /> </a></div><p>Vamos ao ponto:</p><div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&lt;mx :Label id=<span style="color: #ff0000;">&quot;meuLabel&quot;</span> </span><br /> <span style="color: #000000;">x=<span style="color: #ff0000;">&quot;{Application.application.width/2 - meuLabel.width/2}&quot;</span> </span><br /> <span style="color: #000000;">y=<span style="color: #ff0000;">&quot;{Application.application.height/2 - meuLabel.height/2}&quot;</span> </span><br /> <span style="color: #000000;"><span style="color: #7400FF;">/&gt;</span></span></div></div><p>O que o código acima faz é manter um label exatamente no centro da tela. Pra isso, ele coloca o seu X na metade da largura da tela menos a metade da própria largura. O mesmo acontece para o Y.</p><p>Ainda dá pra fazer mais combinações como esta:</p><div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&lt;mx :Label id=<span style="color: #ff0000;">&quot;meuLabel&quot;</span> </span><br /> <span style="color: #000000;">x=<span style="color: #ff0000;">&quot;{Application.application.width*0.8 - meuLabel.width/2}&quot;</span> </span><br /> <span style="color: #000000;">y=<span style="color: #ff0000;">&quot;{Application.application.height/2 - meuLabel.height/2}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span></div></div><p>Neste caso, o Label estaria alinhado mais à direita, 80% pra ser mais preciso. Você pode combinar várias expressões de binding dentro de atributos de posicionamento de seus elementos.</p><p>Os exemplos acima funcionam bem em qualquer situação, mas há como economizar código:</p><div class="codecolorer-container mxml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&lt;mx :Label id=<span style="color: #ff0000;">&quot;meuLabel&quot;</span> </span><br /> <span style="color: #000000;">x=<span style="color: #ff0000;">&quot;{this.width/2 - meuLabel.width/2}&quot;</span> </span><br /> <span style="color: #000000;">y=<span style="color: #ff0000;">&quot;{this.height/2 - meuLabel.height/2}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span></div></div><p>Nesse caso, eu estou usando container raiz como referencia. Se você deixar esse label dentro da sua aplicação, ele vai ficará posicionado exatamente no centro da mesma. Mas se estiver dentro de um módulo, ele estará no centro do módulo.</p><p>O mais bacana de tudo é que ele reposiciona o elemento caso a janela seja redimensionada.</p><p>Simples, não?</p><p>nota: post mais rápido da história: 5 minutos <img src='http://herberthamaral.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p><p>Sem posts relacionados.</p>]]></content:encoded> <wfw:commentRss>http://herberthamaral.com/2010/05/dica-rapida-usando-actionscript-em-expressoes-de-databinding-para-alinhar-elementos-na-tela/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Flex For Kids foi 10!</title><link>http://herberthamaral.com/2010/02/flex-for-kids-foi-10/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=flex-for-kids-foi-10</link> <comments>http://herberthamaral.com/2010/02/flex-for-kids-foi-10/#comments</comments> <pubDate>Sun, 07 Feb 2010 01:46:23 +0000</pubDate> <dc:creator>Herberth Amaral</dc:creator> <category><![CDATA[Flex & Actionscript]]></category> <category><![CDATA[palestras]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[flex builder]]></category> <category><![CDATA[flex for kids]]></category> <category><![CDATA[infobits]]></category> <category><![CDATA[unimontes]]></category><guid isPermaLink="false">http://herberthamaral.com/?p=203</guid> <description><![CDATA[Depois de um dia inteiro de correria, muita palestra e principalmente comida, estou aqui para contar um pouco do Flex For Kids para vocês. Infelizmente, perdemos uma palestra que parecia ser bem legal: Desenvolvimento Multi-touch com AIR 2.0. Tivemos problemas com a conexão e iniciamos meio atrasados. Bem que a porta de saída poderia ser [...]]]></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%2Fherberthamaral.com%2F2010%2F02%2Fflex-for-kids-foi-10%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fherberthamaral.com%2F2010%2F02%2Fflex-for-kids-foi-10%2F&amp;source=HerberthAmaral&amp;style=normal" height="61" width="50" /> </a></div><p>Depois de um dia inteiro de correria, muita palestra e principalmente comida, estou aqui para contar um pouco do Flex For Kids para vocês.</p><p>Infelizmente, perdemos uma palestra que parecia ser bem legal: <em>Desenvolvimento Multi-touch com AIR 2.0</em>. Tivemos problemas com a conexão e iniciamos meio atrasados. Bem que a porta de saída poderia ser a 80 mesmo&#8230; evitaria muitos problemas.</p><p>Conseguimos pegar a palestra do <a href="http://www.igormusardo.com.br/" target="_blank">Igor Musardo </a>(<em>Construa painéis administrativos em Flex integrados com ASP.NET MVC</em>) bem no início, quando ele começou a falar sobre ASP.NET MVC e Flex. Ele mostrou um pequeno sistema para gerenciamento de conteúdo usando o Flex 3 e o ASP.NET MVC como backend e usou o JSON como formato de comunicação. A maioria dos presentes não tinha familiaridade com .NET, mas serviu pra mostrar um pouco da tecnologia. Bem interessante a palestra, mas eu fiquei curioso com o fato dele não usar AMF para isso. Devido à alguns problemas técnicos com a transmissão, a palestra do Musardo acabou atrasando um pouco, mas nada grave.</p><p>A palestra a seguir foi a do <a href="http://www.mariojunior.com/" target="_blank">Mário Junior</a>: <em>Swiz Framework: MVC Simples e Poderoso para projetos Flex/AIR</em>. Como o Mario mesmo disse, o Swiz é extremamente simples e leve, no entanto a palestra dele serviu para mostrar como eu subutilizo os recursos que o Swiz oferece. Ele é muito mais poderoso que eu pensava. Valeu muito pra mim e pra galera da Infobits. Muito boa a palestra dele.</p><p>Como eu estava na organização e nós tínhamos que trazer o almoço para a Unimontes, eu acabei perdendo a palestra do <a href="http://www.flexdev.com.br/" target="_blank">Eberton Consolim</a>: <em>Flex e VOIP: Adicione essa tecnologia em suas aplicações. </em>Segundo a galera que assistiu, a palestra foi excelente, mas infelizmente terei que aguardar o acesso às gravações para ter certeza <img src='http://herberthamaral.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>A próxima palestra logo após o almoço foi a do <a href="http://www.areacriacoes.com.br/" target="_blank">Daniel Lopes</a>:<em> Desktop com HTML, Javascript e  Adobe AIR.</em> A palestra foi muito bem ministrada: muito conceito, muita idéia e pouca explicação de código e ele incrivelmente conseguiu fazer um hands-on sem muitas delongas. Incrível.  Excelente palestra.</p><p>A palestra da <a href="http://www.gabriela.trindade.nom.br/" target="_blank">Gabriela </a>teria sido mais interessante se eu entendesse um pouco mais de User eXperience. No entanto, foi bom ter uma palestra <em>no-code </em> no meio de tantas. Aliás, foi bom ter visto uma mulher no meio de tanto marmanjo <img src='http://herberthamaral.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Mesmo assim, foi proveitosa.</p><p>O<a href="http://www.firescrum.com/" target="_blank"> Eric Calvancanti</a> assumiu a missão de desmistificar o Cairngorm. E posso dizer que ele o fez com muito sucesso! Segundo o Vedovelli, até a avó dele entenderia o que o Eric quis passar. Foi a apresentação mais didática que tivemos, apesar do Cairngorm ser o framework mais complexo apresentado hoje.</p><p>A palestra do <a href="http://www.vedovelli.com.br" target="_blank">Vedovelli </a>foi uma das mais esperadas. Muito conhecido pelos seus screencasts e sua irreverência, o Ved, como costuma ser chamado, se tornou um dos ícones dos Flexers nacionais. Ele explicou como funciona a arquitetura de uma aplicação usando o framework Mate. O framework é interessante e comparável em muitos pontos com o Swiz. Muito boa apresentação.</p><p>O &#8220;vírus da bactéria&#8221; que o cachorro do <a href="http://www.igorcosta.org/ " target="_blank">Igor Costa</a> não consegue ver deixou a sua apresentação muito divertida, além de informativa! O Igor é uma das maiores referencias em Flex e Java no Brasil e sua palestra foi memorável. Eu não saco muita coisa de JEE, mas a palestra dele foi bem inteligível.</p><p>E por último e com a melhor palestra do dia, a do <a href="http://www.becklog.org/">Beck Novaes</a>. Ele deu uma geral sobre a plataforma Adobe de desenvolvimento de RIAs: Flash, Flex, Flash Builder e Flash Catalyst. A palestra foi incrível. Ele tem um mix de explicação extremamente fácil de entender com informação útil. Deveria ter sido a primeira palestra do dia, com toda certeza.</p><p>Nossa reunião na <a href="http://unimontes.br" target="_blank">Unimontes </a>teve uma audiência de 15 pessoas e contou com a organização e apoio da <a href="http://www.infobitsunimontes.com.br" target="_blank">Infobits</a> e da Gerência de Tecnologia da Informação da Unimontes. Queria agradecer a todos que vieram e prestigiaram o evento. Também gostaria de dar os parabéns a todos que tiraram o escorpião do bolso e doaram para o Cotolengo. Muito bacana! A seguir, as fotos do evento:</p><p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="host=picasaweb.google.com&amp;hl=pt_BR&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fherberthamaral%2Falbumid%2F5435276939367326065%3Falt%3Drss%26kind%3Dphoto%26hl%3Dpt_BR" /><param name="src" value="http://picasaweb.google.com/s/c/bin/slideshow.swf" /><embed type="application/x-shockwave-flash" width="600" height="400" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=pt_BR&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fherberthamaral%2Falbumid%2F5435276939367326065%3Falt%3Drss%26kind%3Dphoto%26hl%3Dpt_BR"></embed></object></p><p><h4>Posts relacionados:</h4><ol><li><a href='http://herberthamaral.com/2010/02/eu-vou-participar-do-flex-for-kids-e-voce/' rel='bookmark' title='Permanent Link: Eu vou participar do Flex For Kids. E voce?'>Eu vou participar do Flex For Kids. E voce?</a></li><li><a href='http://herberthamaral.com/2010/04/12elw-foi-show/' rel='bookmark' title='Permanent Link: #12elw foi show!'>#12elw foi show!</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://herberthamaral.com/2010/02/flex-for-kids-foi-10/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Eu vou participar do Flex For Kids. E voce?</title><link>http://herberthamaral.com/2010/02/eu-vou-participar-do-flex-for-kids-e-voce/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=eu-vou-participar-do-flex-for-kids-e-voce</link> <comments>http://herberthamaral.com/2010/02/eu-vou-participar-do-flex-for-kids-e-voce/#comments</comments> <pubDate>Thu, 04 Feb 2010 09:13:41 +0000</pubDate> <dc:creator>Herberth Amaral</dc:creator> <category><![CDATA[Flex & Actionscript]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[flex for kids]]></category> <category><![CDATA[palestras]]></category><guid isPermaLink="false">http://herberthamaral.com/?p=199</guid> <description><![CDATA[Como eu bloguei em outro blog anteriormente, eu vou participar do Flex For Kids! Basicamente, o evento é praticamente uma maratona de palestras: nove palestras de uma hora cada em exatamente nove horas de duração, de 8:00 às 17:00, e contará com palestrantes da comunidade Flexer Brasiliera. Todo dinheiro arrecadado com as inscrições será destinado [...]]]></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%2Fherberthamaral.com%2F2010%2F02%2Feu-vou-participar-do-flex-for-kids-e-voce%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fherberthamaral.com%2F2010%2F02%2Feu-vou-participar-do-flex-for-kids-e-voce%2F&amp;source=HerberthAmaral&amp;style=normal" height="61" width="50" /> </a></div><p>Como eu <a href="http://gwibbers.wordpress.com/2010/01/26/iremos-participar-do-flex-for-kids-venha-voce-tambem/" target="_blank">bloguei </a>em outro <a href="http://gwibbers.wordpress.com" target="_blank">blog </a>anteriormente, eu vou participar do <a href="http://www.flexforkids.com" target="_blank">Flex For Kids</a>!</p><p>Basicamente, o evento é praticamente uma maratona de palestras: nove palestras de uma hora cada em exatamente nove horas de duração, de 8:00 às 17:00, e contará com palestrantes da comunidade Flexer Brasiliera.</p><p>Todo dinheiro arrecadado com as inscrições será destinado à <a href="http://www.flexforkids.com/site/favored" target="_blank">Cotolengo</a>, uma instituição do Mato Grosso do Sul que acolhe pessoas com necessidades especiais.</p><p>Nós, da <a href="http://www.infobitsunimontes.com.br" target="_blank">Infobits</a>, conseguimos reservar o auditório do Centro de Ciências Exatas e Tecnológicas para acomodar os participantes do evento, estamos organizando algumas outras coisas (como o almoço, a alimentação no resto do dia e a inscrição no evento) e temos 8 pessoas já confirmadas (o número vai subir até amanhã).</p><p>Só lembrando: se você quer participar do Flex For Kids conosco, ainda tem tempo! Nos procure na Infobits<strong>*</strong>, mande email, sinal de fumaça ou comente esse post <img src='http://herberthamaral.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>*Sala 10A do Centro de Ciências Exatas e Tecnológicas. Perdido? Veja no <a href="http://maps.google.com/maps/ms?ie=UTF&amp;msa=0&amp;msid= 102720658435516673110.00047ec2b73f9f510f156" target="_blank">Google Maps</a>.</p><p><h4>Posts relacionados:</h4><ol><li><a href='http://herberthamaral.com/2010/02/flex-for-kids-foi-10/' rel='bookmark' title='Permanent Link: Flex For Kids foi 10!'>Flex For Kids foi 10!</a></li><li><a href='http://herberthamaral.com/2010/04/streaming-do-mare-de-agilidade-na-unimontes/' rel='bookmark' title='Permanent Link: Streaming do Mare de Agilidade na Unimontes'>Streaming do Mare de Agilidade na Unimontes</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://herberthamaral.com/2010/02/eu-vou-participar-do-flex-for-kids-e-voce/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Testes unitarios no Flex usando o FlexUnit 4</title><link>http://herberthamaral.com/2010/01/testes-unitarios-no-flex-usando-o-flexunit-4/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=testes-unitarios-no-flex-usando-o-flexunit-4</link> <comments>http://herberthamaral.com/2010/01/testes-unitarios-no-flex-usando-o-flexunit-4/#comments</comments> <pubDate>Thu, 28 Jan 2010 14:12:08 +0000</pubDate> <dc:creator>Herberth Amaral</dc:creator> <category><![CDATA[Flex & Actionscript]]></category> <category><![CDATA[agile]]></category> <category><![CDATA[tdd]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[flex builder]]></category> <category><![CDATA[flexunit 4]]></category> <category><![CDATA[integração contínua]]></category> <category><![CDATA[tutorial]]></category><guid isPermaLink="false">http://herberthamaral.com/?p=179</guid> <description><![CDATA[O FlexUnit 4 é a mais nova versão (não tem a oficial, só a RC, por enquanto) e apresenta uma série de vantagens sobre o seu antecessor, o FlexUnit 0.9, como os metadados de teste ([Test], [After] e [Before], para citar as mais populares), Theories, DataPoints e Assumptions que são úteis para testar grandes quantidades [...]]]></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%2Fherberthamaral.com%2F2010%2F01%2Ftestes-unitarios-no-flex-usando-o-flexunit-4%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fherberthamaral.com%2F2010%2F01%2Ftestes-unitarios-no-flex-usando-o-flexunit-4%2F&amp;source=HerberthAmaral&amp;style=normal" height="61" width="50" /> </a></div><p>O FlexUnit 4 é a mais nova versão (não tem a oficial, só a RC, por enquanto) e apresenta uma série de vantagens sobre o seu antecessor, o FlexUnit 0.9, como os metadados de teste ([Test], [After] e [Before], para citar as mais populares), Theories, DataPoints e Assumptions que são úteis para testar grandes quantidades (talvez até infinita) de dados e ver como a aplicação se comporta e a possibilidade de executar os testes com diferentes Runners.</p><p>Este tutorial tem como objetivo mostrar o básico de testes unitários no Flex, sem se aprofundar muito nos recursos avançados do framework de testes.  Eu pretendo ir postando mais tutoriais à medida que eu for me aprofundando na tecnologia.</p><p><strong>O setup</strong></p><p>Para usar o FlexUnit4, você precisa baixa-lo <a href="http://opensource.adobe.com/wiki/display/flexunit/Downloads" target="_blank">aqui</a>. Após isso, crie um projeto no Flex Builder e adicione todas as libs que vieram no pacote no seu diretório libs:<br /> <a href="http://herberthamaral.com/wp-content/uploads/2010/01/flex_new_project.png"><img class="aligncenter size-full wp-image-180" title="flex_new_project" src="http://herberthamaral.com/wp-content/uploads/2010/01/flex_new_project.png" alt="" width="680" height="591" /></a></p><div id="attachment_182" class="wp-caption aligncenter" style="width: 275px"><a href="http://herberthamaral.com/wp-content/uploads/2010/01/flex_navigator1.png"><img class="size-full wp-image-182" title="flex_navigator" src="http://herberthamaral.com/wp-content/uploads/2010/01/flex_navigator1.png" alt="" width="265" height="308" /></a><p class="wp-caption-text">Verifique se todas as libs estão lá</p></div><p>Como o bom e velho TDD manda, vamos primeiro escrever a classe de teste de exemplo antes de escrever nosso código de produção.</p><p><strong>A classe de teste</strong></p><p>Uma classe de testes é uma classe comum que usa a classe Assert para fazer asserções. No exemplo que irei mostrar, usarei dois tipos básicos de asserção, mas se você observar, o FlexUnit possui vários tipos diferentes de asserções:</p><pre class="brush:java">package tests
{
	import org.flexunit.Assert;
	import org.flexunit.runner.manipulation.filters.IncludeAllFilter;

	import production.BasicClass;

	public class BasicTests
	{
		public function BasicTests(){}
		private var basicClass:BasicClass;

		[Before]
		public function before():void
		{
			basicClass = new BasicClass();
		}

		[Test]
		public function Verifica_Se_As_Duas_Strings_Sao_Iguais():void
		{
			var str:String = "MinhaString";
			Assert.assertTrue(basicClass.areStringsEqual(str,"MinhaString"));
		}

		[Test]
		public function Verifica_Se_A_Soma_Retorna_Resultado_Correto():void
		{
			var soma:int = 10;
			Assert.assertEquals(soma,basicClass.somar(2,8));
		}

		[After]
		public function after():void
		{
			//codigo de after
		}

	}
}</pre><p><strong>A suíte de teste</strong></p><p>A suíte de testes inclui nosso caso de teste descrito acima e será útil para o Flex executar nossos testes. Sendo assim, nossa suíte de testes ficaria mais ou menos desse jeito:</p><pre class="brush:java">package tests
{
	[Suite]
	[RunWith("org.flexunit.runners.Suite")]
	public class MyTestSuite
	{
		public var baseTest:BasicTests;
		public function MyTestSuite(){}

	}
}</pre><p><strong>UITestRunner e o FlexUnitCore</strong></p><p>O UITestRunner é um componente do FlexUnit que mostra os testes numa interface gráfica. Ele ficará na nossa aplicação e mostrará os resultados dos testes.</p><p>O FlexUnitCore será o responsável por carregar as suítes de teste e por passar os dados de saída de testes para o UITestRunner. No nosso caso, nossa aplicação principal ficaria assim:</p><pre class="brush:xml">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="run()" layout="absolute" xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"&gt;
    &lt;mx:Script&gt;
    &lt;![CDATA[
       import tests.MyTestSuite;
       import org.flexunit.listeners.UIListener;
       import org.flexunit.runner.FlexUnitCore;

       public var core:FlexUnitCore;
       public function run():void
       {
           core = new FlexUnitCore();
           core.addListener(new UIListener(uiRunner));
           core.run(MyTestSuite);
      }
    ]]&gt;
   &lt;/mx:Script&gt;
   &lt;flexUnitUIRunner:TestRunnerBase id="uiRunner"  width="100%" height="100%"/&gt;
&lt;/mx:Application&gt;</pre><p><strong>O código de produção</strong></p><p>Ufa! Depois de escrever a classe de teste, a suíte de teste e o runner, podemos nos focar em fazer nosso código de produção <img src='http://herberthamaral.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Dêem uma olhada em como ficaria o dito:</p><pre class="brush:java">package production
{
	public class BasicClass
	{
		public function BasicClass(){}

		public function areStringsEqual(string1:String,string2:String):Boolean
		{
			return (string1==string2);
		}

		public function somar(valor1:int,valor2:int):int
		{
			return valor1+valor2;
		}

	}
}</pre><p><strong>E Voilà!</strong></p><p>Depois de tudo pronto, a cara da criança ficaria mais ou menos assim:</p><p><a href="http://herberthamaral.com/wp-content/uploads/2010/01/ui_runner.png"><img class="aligncenter size-medium wp-image-190" title="ui_runner" src="http://herberthamaral.com/wp-content/uploads/2010/01/ui_runner-300x177.png" alt="" width="300" height="177" /></a></p><p>Legal, não? E ainda dá pra fazer com que o FlexUnit4 exporte o resultado dos testes para um arquivo XML, permitindo que seus testes no Flex sejam importados pelo seu sistema de Integração Contínua, mas isso é assunto para outro post <img src='http://herberthamaral.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Você pode baixar o código fonte <a href="http://herberthamaral.com/wp-content/tutoriais/flexunit4/UsandoFlexUnit4.zip" target="_blank">aqui</a> e ver os exemplos rodando online <a href="http://herberthamaral.com/wp-content/tutoriais/flexunit4/" target="_blank">aqui</a>.</p><p>Good testing!</p><p>Sem posts relacionados.</p>]]></content:encoded> <wfw:commentRss>http://herberthamaral.com/2010/01/testes-unitarios-no-flex-usando-o-flexunit-4/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Usando o SabreAMF com o CakePHP</title><link>http://herberthamaral.com/2009/12/usando-o-sabreamf-com-o-cakephp/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=usando-o-sabreamf-com-o-cakephp</link> <comments>http://herberthamaral.com/2009/12/usando-o-sabreamf-com-o-cakephp/#comments</comments> <pubDate>Tue, 15 Dec 2009 21:25:33 +0000</pubDate> <dc:creator>Herberth Amaral</dc:creator> <category><![CDATA[Flex & Actionscript]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[cakephp]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[hello world]]></category> <category><![CDATA[sabreamf]]></category><guid isPermaLink="false">http://herberthamaral.com/?p=66</guid> <description><![CDATA[O AMF é um formato aberto de comunicação do Flash. É o formato preferido para tais aplicações por possuir diversas vantagens, sendo que a principal delas é a velocidade, já que o AMF não precisa ser deserializado como o XML e o JSON. Por ser um formato aberto, ele pode ser implementado em qualquer linguagem. [...]]]></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%2Fherberthamaral.com%2F2009%2F12%2Fusando-o-sabreamf-com-o-cakephp%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fherberthamaral.com%2F2009%2F12%2Fusando-o-sabreamf-com-o-cakephp%2F&amp;source=HerberthAmaral&amp;style=normal" height="61" width="50" /> </a></div><p>O <a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank">AMF</a> é um formato aberto de comunicação do Flash. É o formato preferido para tais aplicações por possuir diversas vantagens, sendo que a principal delas é a velocidade, já que o AMF não precisa ser deserializado como o XML e o JSON.</p><p>Por ser um formato aberto, ele pode ser implementado em qualquer linguagem. Há várias implementações para o PHP, sendo que as mais notáveis são o AMFPHP, Zend_AMF e o SabreAMF.</p><p>Neste tutorial, eu mostrarei como desenvolver aplicações em PHP com o framework CakePHP que se comunicam com o Flash (usando a plataforma Flex 3) através da biblioteca SabreAMF.</p><h4>1- Baixando e instalando os componentes</h4><p>1 &#8211; Baixe os CakePHP 1.2.5 no <a href="http://www.cakephp.org" target="_blank">site do CakePHP</a> e o SabreAMF no <a href="http://code.google.com/p/sabreamf/downloads/list" target="_blank">Google Code</a>.</p><p>2- <a href="http://book.cakephp.org/pt/view/308/Installing-CakePHP" target="_blank">Instale o CakePHP</a> de forma que ele fique disponível em http://localhost/cakeflex.</p><p>3 &#8211; Descompacte o SabreAmf em app/vendors/SabreAMF</p><h4>2 &#8211; Colocando os dois para trabalhar</h4><p>Para fazer com que o CakePHP trabalhe de forma transparente com o SabreAMF, é necessário<a href="http://book.cakephp.org/view/64/Creating-Components"> criar um componente para o CakePHP</a>.</p><p>Para tal, vamos criar o nosso componente: (salve-o em app/controllers/components/sabre_amf.php)</p><div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br /> <br /> <a href="http://www.php.net/set_include_path"><span style="color: #990000;">set_include_path</span></a><span style="color: #009900;">&#40;</span>APP<span style="color: #339933;">.</span><span style="color: #0000ff;">'vendors'</span> <span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> <a href="http://www.php.net/get_include_path"><span style="color: #990000;">get_include_path</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> App<span style="color: #339933;">::</span><span style="color: #004000;">import</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Vendor'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'SabreAMF_CallbackServer'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'file'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'SabreAMF/CallbackServer.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> <br /> <span style="color: #000000; font-weight: bold;">class</span> SabreAmfComponent <span style="color: #000000; font-weight: bold;">extends</span> Object <span style="color: #009900;">&#123;</span><br /> <br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span><span style="color: #000088;">$controller</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">action</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'gateway'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$_cakeController</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$_cakeController</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$controller</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Configure<span style="color: #339933;">::</span><span style="color: #004000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'debug'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoRender</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$server</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SabreAMF_CallbackServer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">onInvokeService</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'amfCallBack'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">amfExclude</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">!</span><a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">action</span><span style="color: #339933;">,</span><span style="color: #000088;">$controller</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">amfExclude</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> <br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> amfCallBack<span style="color: #009900;">&#40;</span><span style="color: #000088;">$service</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$_cakeController</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_cakeController</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/method_exists"><span style="color: #990000;">method_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_cakeController</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span> &nbsp;and<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">!</span><a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_cakeController</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">action</span><span style="color: #339933;">,</span><span style="color: #000088;">$_cakeController</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">amfExclude</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/call_user_func_array"><span style="color: #990000;">call_user_func_array</span></a><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_cakeController</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Action nao encontrada.&quot;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Nome de metodo invalido.&quot;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Controller nao encontrado.&quot;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$res</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> <span style="color: #009900;">&#125;</span><br /> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p>O que nós fizemos acima foi redirecionar todas as chamadas à action &#8216;gateway&#8217; do controller para nosso gateway do SabreAMF.</p><p>Agora, um exemplo de como utilizar isso em um controller:</p><div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br /> <span style="color: #666666; font-style: italic;">// app/controllers/teste_amf_controller.php</span><br /> <span style="color: #000000; font-weight: bold;">class</span> TesteAmfController <span style="color: #000000; font-weight: bold;">extends</span> AppController<br /> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$components</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SabreAmf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /> <br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> hello<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Olá, &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$nome</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;! agora são: &quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H:i:s&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; horas&quot;</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> &nbsp;<span style="color: #000088;">$ret</span><span style="color: #339933;">;</span><br /> &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /> <span style="color: #009900;">&#125;</span><br /> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p>Nosso server side não estaria completo sem o nosso model. No meu caso, como é só uma demonstração, eu não quero criar uma tabela no banco de dados. Portanto, eu crio o meu model dessa forma:</p><div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br /> <span style="color: #666666; font-style: italic;">// app/models/teste_amf.php</span><br /> <span style="color: #000000; font-weight: bold;">class</span> TesteAmf <span style="color: #000000; font-weight: bold;">extends</span> AppModel<br /> <span style="color: #009900;">&#123;</span><br /> &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$useTable</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br /> <span style="color: #009900;">&#125;</span><br /> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p>Para demonstrar nosso código funcionado, nada melhor que uma aplicação Flex. Segue abaixo, um exemplo de como a configuração criada acima pode ser usada no Flex:</p><pre>
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt;

	&lt;mx:RemoteObject
		endpoint="http://localhost/cakeflex/teste_amf/gateway"
		id="rmoTeste"
		source=""
		destination="minhaApp"
		result="rmoTesteResult(event)"
		fault="rmoTesteFail(event)"
		showBusyCursor="true"
		/&gt;

        &lt;mx:Button label="Hello!" click="rmoTeste.hello('Herberth')" /&gt;
        &lt;mx:Script&gt;
		&lt; ![CDATA[
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			import mx.controls.Alert;

			public function rmoTesteResult(e:ResultEvent):void
			{
				Alert.show(e.result.toString());
			}

			public function rmoTesteFail(e:FaultEvent):void
			{
				Alert.show("Fail!");
			}
		]]&gt;
	&lt;/mx:Script&gt;
&lt;/mx:Application&gt;
</pre><h4>4 &#8211; Conclusão</h4><p>O resultado final deve ficar parecido com isso:</p><p><img class="alignnone size-full wp-image-81" title="hello_flex" src="http://herberthamaral.com/wp-content/uploads/2009/12/hello_flex.png" alt="hello_flex" width="525" height="272" /></p><p>É possível retornar tipos mais complexos para serem usados em tipos mais complexos (tipo AdvancedDataGrid), mas irei abordar tal aplicação mais futuramente.</p><h4>5 &#8211; Referências</h4><ul><li><a href="http://blog.non-style.com/2008/11/cakephp-airsabreamfcakephp.html">http://blog.non-style.com/2008/11/cakephp-airsabreamfcakephp.html</a></li></ul><p>É isso aí pessoal. Até a próxima!</p><p>Sem posts relacionados.</p>]]></content:encoded> <wfw:commentRss>http://herberthamaral.com/2009/12/usando-o-sabreamf-com-o-cakephp/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>