<?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>Stefan Horochovec &#187; AIR</title>
	<atom:link href="http://www.horochovec.com.br/blog/category/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.horochovec.com.br/blog</link>
	<description>Blog sobre plataforma Flash - Flex e AIR - e sua integração com Java</description>
	<lastBuildDate>Mon, 12 Jul 2010 02:01:05 +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>FlexORM – Framework ORM para persistência em AIR 1.5 &#8211; Download</title>
		<link>http://www.horochovec.com.br/blog/2010/01/27/flexorm-%e2%80%93-framework-orm-para-persistencia-em-air-1-5-download/</link>
		<comments>http://www.horochovec.com.br/blog/2010/01/27/flexorm-%e2%80%93-framework-orm-para-persistencia-em-air-1-5-download/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 00:42:31 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[FlexORM]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=270</guid>
		<description><![CDATA[Olá pessoal Conforme prometido através de comentários no post anterior, segue o download do projeto DuckToDo com a implementação de um projeto utilizando FlexORM com AIR 1.5 Download aqui. Forte abraço]]></description>
			<content:encoded><![CDATA[<p>Olá pessoal</p>
<p>Conforme prometido através de comentários no post anterior, segue o download do projeto DuckToDo com a implementação de um projeto utilizando FlexORM com AIR 1.5</p>
<p>Download <a href="http://www.horochovec.com.br/DuckToDo.zip" target="_new">aqui</a>.</p>
<p>Forte abraço</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2010/01/27/flexorm-%e2%80%93-framework-orm-para-persistencia-em-air-1-5-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexORM &#8211; Framework ORM para persistência em AIR 1.5</title>
		<link>http://www.horochovec.com.br/blog/2010/01/27/flexorm-framework-orm-para-persistencia-em-air-1-5/</link>
		<comments>http://www.horochovec.com.br/blog/2010/01/27/flexorm-framework-orm-para-persistencia-em-air-1-5/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 03:08:04 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[FlexORM]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=250</guid>
		<description><![CDATA[Olá pessoal, Neste artigo, irei comentar um pouco sobre o FlexORM. Este framework tem como objetivo o mapeamento objeto-relacional em projetos que utilizem AIR e base de dados embarcada (SQLite). O FlexORM é uma criação de Mark Moloney, e é hospedado pela RIAForge. O FlexORM tem suporte a versão 1.5 do AIR e abaixo, podemos [...]]]></description>
			<content:encoded><![CDATA[<p>Olá pessoal,</p>
<p>Neste artigo, irei comentar um pouco sobre o <a href="http://flexorm.riaforge.org/" target="_new">FlexORM</a>. Este framework tem como objetivo o mapeamento objeto-relacional em projetos que utilizem AIR e base de dados embarcada (SQLite).</p>
<p><span id="more-250"></span></p>
<p>O FlexORM é uma criação de <a href="http://flexorm.riaforge.org/index.cfm?event=page.myprojects&amp;id=2317" target="_new">Mark Moloney</a>, e é hospedado pela <a href="http://riaforge.org/" target="_new">RIAForge</a>.</p>
<p>O FlexORM tem suporte a versão 1.5 do AIR e abaixo, podemos listar algumas de suas vantagens para seu uso:</p>
<p>* Não há necessidade de criação e atualização de tabelas. O FlexORM se encarrega da criação da estrutura do banco, através de um mapeamento feito dentro do próprio objeto a ser persistido;</p>
<p>* Possui suporte as operações CRUD;</p>
<p>* Suporta associações 1:N, N:M, N:1 e 1:1;</p>
<p>* Suporte a atributos transientes;</p>
<p>* Suporte a constraints para consistência de chaves-estrangeiras, através de triggers do SQLite;</p>
<p>* Transações;</p>
<p>* Criação automática de índices;</p>
<p>* Lazy Loading;</p>
<p>* Dentre outras;</p>
<p>Para exemplificar o uso do FlexORM, irei criar um projeto chamado DuckToDo e o objetivo do projeto é que eu possa cadastrar algumas tarefas que eu precise realizar. A aplicação é bem simples no quesito visual, uma vez que o intuito do artigo é o conhecimento do FlexORM.</p>
<p>Para iniciar, iremos criar um projeto no FlexBuilder chamado DuckToDo, conforme a tela abaixo:</p>
<p><a href="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/12.jpg"><img class="aligncenter size-full wp-image-255" title="Novo Projeto" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/12.jpg" alt="" width="550" height="478" /></a></p>
<p>Em seguida, vá as propriedades do projeto, e na opção Flex Compiler, adicione a seguinte linha de comando &#8221; -keep-as3-metadata+=Table,Id,Column,ManyToOne,OneToMany,ManyToMany,Transient&#8221;, para que o compilador interprete as Metadatas adicionadas ao mapeamento dos Beans, conforme tela abaixo:</p>
<p><a href="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/21.jpg"><img class="aligncenter size-full wp-image-257" title="Project Properties" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/21.jpg" alt="" width="550" height="364" /></a></p>
<p>Feito isso, você deve fazer o download do FlexORM e adicionar ao seu projeto. Você pode optar por fazer o download do source através de um servidor de versionamento (subversion), ou fazer o download através deste <a href="http://www.horochovec.com.br/blog/flexorm.swc" target="_new">link</a> do arquivo .SWC do projeto FlexORM.</p>
<p>Depois de obter o .SWC, ou por download, ou recompilando o projeto, você deve adicioná-lo a pasta lib/ de seu projeto.</p>
<p>Feito isso, criaremos nossa classe de objeto que será persistida pela nossa aplicação.</p>
<p>Crie uma nova classe actionscript na package &#8220;org.flexduck.model&#8221; chamada Todo, e adicione o código abaixo:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p250code6'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2506"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code" id="p250code6"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>flexduck<span style="color: #000066; font-weight: bold;">.</span>model
<span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Table<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;TODO&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Todo
	<span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#91;</span>Id<span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> codigo 	<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Column<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;titulo&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> titulo 	<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#91;</span>Column<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;descricao&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> descricao <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Neste momento, quem trabalha com Java e utiliza Hibernate ou JPA já percebe uma grande semelhança. Através da Metadata <strong>[Table]</strong> no escopo da classe, definimos a qual tabela este objeto deve ser persistido.</p>
<p>No atributo codigo, foi adicionado a Metadata <strong>[Id]</strong> indicando que esse atributo corresponde a chave primária, ou o identificador, do objeto.</p>
<p>E nos atributos, titulo e descrição, adicionado a Metadata <strong>[Column]</strong> indicando que refere-se a uma coluna. Junto a Metadata também foi adicionado o nome respectivo da coluna na tabela.</p>
<p>Com isso, nosso bean está pronto para ser persistido. Vamos para a sua gravação.</p>
<p>Dentro do arquivo DuckToDo.mxml foi criada a seguinte estrutura de componentes.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p250code7'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2507"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code" id="p250code7"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Binding destination=<span style="color: #990000;">&quot;todo.titulo&quot;</span> 		<span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;titulo.text&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Binding destination=<span style="color: #990000;">&quot;todo.descricao&quot;</span> 	<span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;descricao.text&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Panel <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;500&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;250&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> title=<span style="color: #990000;">&quot;O que tenho para fazer?&quot;</span> horizontalCenter=<span style="color: #990000;">&quot;0&quot;</span> verticalCenter=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>ViewStack id=<span style="color: #990000;">&quot;vw&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas label=<span style="color: #990000;">&quot;Grid&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Título&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextInput <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;29&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;460&quot;</span> id=<span style="color: #990000;">&quot;titulo&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{this.todo.titulo}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;58&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Descrição&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextArea <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;75&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;460&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;85&quot;</span> id=<span style="color: #990000;">&quot;descricao&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{this.todo.descricao}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;318&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Adicionar&quot;</span> id=<span style="color: #990000;">&quot;btnAdd&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnAddHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;252&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Listar&quot;</span> id=<span style="color: #990000;">&quot;btnListar&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnListarHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;189&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Novo&quot;</span> id=<span style="color: #990000;">&quot;btnNovo&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnNovoHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;406&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Excluir&quot;</span> id=<span style="color: #990000;">&quot;btnDel&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnDelHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas label=<span style="color: #990000;">&quot;Formulario&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGrid 	<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;30&quot;</span> 
						id=<span style="color: #990000;">&quot;dg&quot;</span> 
						<span style="color: #004993;">doubleClickEnabled</span>=<span style="color: #990000;">&quot;true&quot;</span> 
						<span style="color: #004993;">doubleClick</span>=<span style="color: #990000;">&quot;doubleClickHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
				<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;titulo&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGrid<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Pesquisar&quot;</span> id=<span style="color: #990000;">&quot;btnPesquisar&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnPesquisarHandler(event);&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Cadastrar&quot;</span> id=<span style="color: #990000;">&quot;btnCadastrar&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnCadastrarHandler(event);&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>ViewStack<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Panel<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Essa estrutura corresponde a um Panel, contendo um ViewStack com dois Canvas dentro. Para o primeiro Canvas foi adicionado um Grid para conter a lista de tarefas e no segundo Canvas, um pequeno formulário para a manutenção dos registros.</p>
<p><strong>Nesse artigo não irei comentar sobre a estrutura do formulário, considerando apenas como relevante as instruções de uso do FlexORM.</strong></p>
<p>Foi adicionado um evento no <strong>creationComplete</strong> da minha aplicação, para instanciar o banco de dados, conforme declaração abaixo:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p250code8'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2508"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p250code8"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> 
						creationComplete=<span style="color: #990000;">&quot;initApp(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>E dentro do bloco de programação em ActionScript foi adicionado:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p250code9'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2509"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
</pre></td><td class="code" id="p250code9"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>flexduck<span style="color: #000066; font-weight: bold;">.</span>model<span style="color: #000066; font-weight: bold;">.</span>Todo<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> nz<span style="color: #000066; font-weight: bold;">.</span>co<span style="color: #000066; font-weight: bold;">.</span>codec<span style="color: #000066; font-weight: bold;">.</span>flexorm<span style="color: #000066; font-weight: bold;">.</span>EntityManager<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Objeto de persistencia
 */</span> 
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> genericDAO 	<span style="color: #000066; font-weight: bold;">:</span> EntityManager	= EntityManager<span style="color: #000066; font-weight: bold;">.</span>instance<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Classe para listar
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> todoClass	<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a>			= Todo<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Bean
 */</span>
<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> todo		<span style="color: #000066; font-weight: bold;">:</span> Todo			= <span style="color: #0033ff; font-weight: bold;">new</span> Todo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Evento disparado no creationComplete da aplicação para fazer a conexão com o banco de dados
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> initApp<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> appDataBase <span style="color: #000066; font-weight: bold;">:</span> File = File<span style="color: #000066; font-weight: bold;">.</span>documentsDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;ducktodo.db&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> sqlConn		<span style="color: #000066; font-weight: bold;">:</span> SQLConnection	= <span style="color: #0033ff; font-weight: bold;">new</span> SQLConnection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	sqlConn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>appDataBase<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>sqlConnection	= sqlConn<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Adicionar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnAddHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">save</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>findAll<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todoClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Excluir&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnDelHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>remove<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>findAll<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todoClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no duplo click no grid de pesquisa
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> doubleClickHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>selectedItem <span style="color: #0033ff; font-weight: bold;">as</span> Todo<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>vw<span style="color: #000066; font-weight: bold;">.</span>selectedIndex	= <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Pesquisar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnPesquisarHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>findAll<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todoClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Cadastrar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnCadastrarHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>vw<span style="color: #000066; font-weight: bold;">.</span>selectedIndex 	= <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Listar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnListarHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>vw<span style="color: #000066; font-weight: bold;">.</span>selectedIndex	= <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Novo&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnNovoHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo	= <span style="color: #0033ff; font-weight: bold;">new</span> Todo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Alguns comentários relevantes:</p>
<p>Na função <strong>initApp</strong>, foi criado uma conexão SQLConnection, e a mesma foi passada para um objeto chamado genericDAO. Este objeto é uma instancia da classe EntityManager do FlexORM, responsável por executar os métodos para manipulação do banco de dados.</p>
<p>Na função <strong>btnAddHandler</strong> foi feita a persistencia do objeto Todo. Perceba que essa função é responsável por gravar e atualizar o objeto, não sendo necessário que o desenvolvedor se preocupe com a operação específica, apenas que em determinado momento, o objeto deve ser persistido, gravando-o ou fazendo sua atualização.</p>
<p>Na função <strong>btnDelHandler</strong> foi solicitado que determinado objeto fosse apagado do banco de dados.</p>
<p>Na função <strong> btnPesquisarHandler</strong> foi solicitado uma busca em todos os registros de determinada Classe, e não um objeto, fique atento a essa situação.</p>
<p>Os demais eventos servem para a navegação da tela, portanto, não serão comentados. </p>
<p>Se você fez corretamente a inclusão de todos os fontes, terá o resultado:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p250code10'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25010"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
</pre></td><td class="code" id="p250code10"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> 
						creationComplete=<span style="color: #990000;">&quot;initApp(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>flexduck<span style="color: #000066; font-weight: bold;">.</span>model<span style="color: #000066; font-weight: bold;">.</span>Todo<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> nz<span style="color: #000066; font-weight: bold;">.</span>co<span style="color: #000066; font-weight: bold;">.</span>codec<span style="color: #000066; font-weight: bold;">.</span>flexorm<span style="color: #000066; font-weight: bold;">.</span>EntityManager<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Objeto de persistencia
 */</span> 
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> genericDAO 	<span style="color: #000066; font-weight: bold;">:</span> EntityManager	= EntityManager<span style="color: #000066; font-weight: bold;">.</span>instance<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Classe para listar
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> todoClass	<span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html"><span style="color: #004993;">Class</span></a>			= Todo<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Bean
 */</span>
<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> todo		<span style="color: #000066; font-weight: bold;">:</span> Todo			= <span style="color: #0033ff; font-weight: bold;">new</span> Todo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Evento disparado no creationComplete da aplicação para fazer a conexão com o banco de dados
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> initApp<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> appDataBase <span style="color: #000066; font-weight: bold;">:</span> File = File<span style="color: #000066; font-weight: bold;">.</span>documentsDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;ducktodo.db&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> sqlConn		<span style="color: #000066; font-weight: bold;">:</span> SQLConnection	= <span style="color: #0033ff; font-weight: bold;">new</span> SQLConnection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	sqlConn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>appDataBase<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>sqlConnection	= sqlConn<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Adicionar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnAddHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">save</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>findAll<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todoClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Excluir&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnDelHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>remove<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>findAll<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todoClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no duplo click no grid de pesquisa
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> doubleClickHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>selectedItem <span style="color: #0033ff; font-weight: bold;">as</span> Todo<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>vw<span style="color: #000066; font-weight: bold;">.</span>selectedIndex	= <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Pesquisar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnPesquisarHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>dg<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>genericDAO<span style="color: #000066; font-weight: bold;">.</span>findAll<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todoClass<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Cadastrar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnCadastrarHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>vw<span style="color: #000066; font-weight: bold;">.</span>selectedIndex 	= <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Listar&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnListarHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>vw<span style="color: #000066; font-weight: bold;">.</span>selectedIndex	= <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * Função disparada no click do botão de &quot;Novo&quot;
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> btnNovoHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>todo	= <span style="color: #0033ff; font-weight: bold;">new</span> Todo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Binding destination=<span style="color: #990000;">&quot;todo.titulo&quot;</span> 		<span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;titulo.text&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Binding destination=<span style="color: #990000;">&quot;todo.descricao&quot;</span> 	<span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;descricao.text&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Panel <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;500&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;250&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> title=<span style="color: #990000;">&quot;O que tenho para fazer?&quot;</span> horizontalCenter=<span style="color: #990000;">&quot;0&quot;</span> verticalCenter=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>ViewStack id=<span style="color: #990000;">&quot;vw&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas label=<span style="color: #990000;">&quot;Grid&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Título&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextInput <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;29&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;460&quot;</span> id=<span style="color: #990000;">&quot;titulo&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{this.todo.titulo}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;58&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Descrição&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextArea <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;75&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;460&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;85&quot;</span> id=<span style="color: #990000;">&quot;descricao&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{this.todo.descricao}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;318&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Adicionar&quot;</span> id=<span style="color: #990000;">&quot;btnAdd&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnAddHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;252&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Listar&quot;</span> id=<span style="color: #990000;">&quot;btnListar&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnListarHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;189&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Novo&quot;</span> id=<span style="color: #990000;">&quot;btnNovo&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnNovoHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;406&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;172&quot;</span> label=<span style="color: #990000;">&quot;Excluir&quot;</span> id=<span style="color: #990000;">&quot;btnDel&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnDelHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas label=<span style="color: #990000;">&quot;Formulario&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGrid 	<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;30&quot;</span> 
						id=<span style="color: #990000;">&quot;dg&quot;</span> 
						<span style="color: #004993;">doubleClickEnabled</span>=<span style="color: #990000;">&quot;true&quot;</span> 
						<span style="color: #004993;">doubleClick</span>=<span style="color: #990000;">&quot;doubleClickHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
				<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;titulo&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGrid<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Pesquisar&quot;</span> id=<span style="color: #990000;">&quot;btnPesquisar&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnPesquisarHandler(event);&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Cadastrar&quot;</span> id=<span style="color: #990000;">&quot;btnCadastrar&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;btnCadastrarHandler(event);&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>ViewStack<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Panel<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Basta exportar sua aplicação, e tudo deverá funcionar perfeitamente.</p>
<p>Forte abraço e até a próxima!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2010/01/27/flexorm-framework-orm-para-persistencia-em-air-1-5/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Instalando AIR 2.0 no seu Flash Builder</title>
		<link>http://www.horochovec.com.br/blog/2010/01/12/instalando-air-2-0-no-seu-flash-builder/</link>
		<comments>http://www.horochovec.com.br/blog/2010/01/12/instalando-air-2-0-no-seu-flash-builder/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 05:30:52 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[AIR 2.0]]></category>
		<category><![CDATA[SDK]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=217</guid>
		<description><![CDATA[Olá pessoal, Primeiramente quero desejar um Feliz 2010 a todos os leitores do blog! Esse ano promete, teremos o lançamento no novo Flash Builder 4 com o Flex SDK 4.0, AIR 2.0 e Flash Catalyst, além das novas versões dos softwares da Adobe para a versão CS5, a qual venho testando a alguns meses e [...]]]></description>
			<content:encoded><![CDATA[<p>Olá pessoal, Primeiramente quero desejar um Feliz 2010 a todos os leitores do blog!</p>
<p>Esse ano promete, teremos o lançamento no novo Flash Builder 4 com o Flex SDK 4.0, AIR 2.0 e Flash Catalyst, além das novas versões dos softwares da Adobe para a versão CS5, a qual venho testando a alguns meses e tenho me surpreendido bastante, principalmente com o Flash CS5, agora com recursos para desenvolvimento para Iphone, mas este será um assunto específico para outro post, nesse artigo, iremos tratar apenas da instalação do AIR 2.0 dentro do Flash Builder 4.</p>
<p><span id="more-217"></span></p>
<p>O primeiro passo é fazer o download da nova versão do AIR 2.0 disponível no Adobe Labs. Para fazer o download clique <a href="http://labs.adobe.com/downloads/air2.html" target="_new">aqui</a>. No meu caso, eu fiz o download e salvei o arquivo AIR20_win_sdk_010710.zip dentro da pasta sdks\ da instalação do meu Flash Builder.</p>
<p><img class="aligncenter size-full wp-image-221" title="AIR SKD Download" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/11.jpg" alt="AIR SKD Download" width="498" height="369" /></p>
<p>Feito o download, você deve duplicar a pasta 4.0.0 que contem a nova versão do SDK do Flex, e após isso adicionar o conteúdo do SDK da nova versão do AIR para dentro da nova pasta que você acabou de duplicar. No meu caso, antes de copiar os arquivos do SDK do AIR eu alterei o nome da pasta para &#8220;4.0.0 + AIR 2.0.0 Beta&#8221; e depois copiei todos os arquivos do novo SDK do AIR para dentro da nova pasta. Confirmei que todos os arquivos que já existiam com o mesmo nome deveriam ser sobre-escritos.</p>
<p><img class="aligncenter size-full wp-image-223" title="Fusão de pastas = Flex SDK + AIR SDK" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/2.jpg" alt="Fusão de pastas = Flex SDK + AIR SDK" width="498" height="369" /></p>
<p>Ok, feito isso, podemos abrir o Flash Builder e fazer a configuração do SDK para utilização.</p>
<p>Ao abrir o Flash Builder, vá ao menu: Window -&gt; Preferences. Nesta janela, iremos adicionar um novo SDK para o Flash Builder, conforme a imagem abaixo:</p>
<p><img class="aligncenter size-full wp-image-226" title="3" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/3.jpg" alt="3" width="498" height="369" /></p>
<p>Após clicar em &#8220;Add&#8221;, seguimos com a configuração abaixo. Perceba que eu adicionei ao &#8220;Flex SDK Location&#8221; o caminho do SDK copiado do 4.0.0 e com a adição do SDK no AIR 2.0.0.</p>
<p><img class="aligncenter size-full wp-image-228" title="4" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/4.jpg" alt="4" width="514" height="195" /></p>
<p>E como resultado final:</p>
<p><img class="aligncenter size-full wp-image-229" title="5" src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/5.jpg" alt="5" width="498" height="369" /></p>
<p>Agora iremos criar um novo projeto, conforme as configurações da tela abaixo. Atente para a opção aonde eu digo que quero usar uma versão específica do SDK e marco o SDK &#8220;<em>4.0.0 + AIR 2.0.0Beta</em>&#8220;. </p>
<p><img src="http://www.horochovec.com.br/blog/wp-content/uploads/2010/01/6.jpg" alt="6" title="6" width="484" height="510" class="aligncenter size-full wp-image-231" /></p>
<p>Clicando em &#8220;Finish&#8221;, uma vez que não será necessário mais nenhuma configuração, nosso projeto está apto a trabalhar com a versão 2.0 do AIR SDK. </p>
<p>Dentro do arquivo, Main-app.xml na segunda linha, podemos ver a indicação da versão do SDK no arquivo de configuração para compilação do projeto.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=217&amp;download=Main-app.xml">Main-app.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21713"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p217code13"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span> standalone=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>application xmlns=<span style="color: #990000;">&quot;http://ns.adobe.com/air/application/2.0beta2&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;!--</span> Adobe AIR Application Descriptor File Template<span style="color: #000066; font-weight: bold;">.</span>
&nbsp;
	Specifies <span style="color: #004993;">parameters</span> <span style="color: #0033ff; font-weight: bold;">for</span> identifying<span style="color: #000066; font-weight: bold;">,</span> installing<span style="color: #000066; font-weight: bold;">,</span> and launching AIR applications<span style="color: #000066; font-weight: bold;">.</span>
&nbsp;
	xmlns <span style="color: #000066; font-weight: bold;">-</span> The Adobe AIR <span style="color: #004993;">namespace</span><span style="color: #000066; font-weight: bold;">:</span> http<span style="color: #000066; font-weight: bold;">:</span><span style="color: #009900; font-style: italic;">//ns.adobe.com/air/application/2.0beta2</span>
			The last segment of the <span style="color: #004993;">namespace</span> specifies the <span style="color: #004993;">version</span> 
			of the AIR runtime required <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">this</span> application to run<span style="color: #000066; font-weight: bold;">.</span>
&nbsp;
	minimumPatchLevel <span style="color: #000066; font-weight: bold;">-</span> The minimum patch <span style="color: #004993;">level</span> of the AIR runtime required to run 
			the application<span style="color: #000066; font-weight: bold;">.</span> Optional<span style="color: #000066; font-weight: bold;">.</span>
<span style="color: #000066; font-weight: bold;">--&gt;</span></pre></td></tr></table></div>

<p>Outro teste comum que você poderá encontrar em outros tutoriais com o mesmo objetivo que este é a instância de um objeto do tipo NativeProcess, que é uma classe específica desta versão do AIR, disponível no pacote: <em><strong>flash.desktop.</strong></em>. Você poderá fazer o teste da seguinte forma:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=217&amp;download=Main.mxml">Main.mxml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21714"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p217code14"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> 
					   xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> 
					   xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/mx&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Declarations<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;!--</span> Place non<span style="color: #000066; font-weight: bold;">-</span>visual <span style="color: #004993;">elements</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span>g<span style="color: #000066; font-weight: bold;">.,</span> services<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">value</span> objects<span style="color: #000000;">&#41;</span> here <span style="color: #000066; font-weight: bold;">--&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Declarations<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> nativeProcess <span style="color: #000066; font-weight: bold;">:</span> NativeProcess<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Bom pessoal, espero ter ajudado a quem quer testar e ainda tinha dúvidas de como proceder a instalação do AIR 2.0 dentro do Flash Builder 4.</p>
<p>Um abraço e até a próxima!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2010/01/12/instalando-air-2-0-no-seu-flash-builder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adobe Shibuya</title>
		<link>http://www.horochovec.com.br/blog/2009/10/15/adobe-shibuya/</link>
		<comments>http://www.horochovec.com.br/blog/2009/10/15/adobe-shibuya/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 22:01:30 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Shibuya]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=193</guid>
		<description><![CDATA[Ola pessoal, A Adobe está melhorando cada vez mais o client AIR para que as empresas venham a desenvolver suas aplicações pensando em sua utilização. O AIR possui tudo que você precisa para criar um processo de distribuição da sua aplicação em qualquer sistema operacional e possibilita diversas customizações para o processo de instalação e [...]]]></description>
			<content:encoded><![CDATA[<p>Ola pessoal,</p>
<p>A <a href="http://www.adobe.com/" target="_new">Adobe</a> está melhorando cada vez mais o <em>client</em> AIR para que as empresas venham a desenvolver suas aplicações pensando em sua utilização.</p>
<p>O AIR possui tudo que você precisa para criar um processo de distribuição da sua aplicação em qualquer sistema operacional e possibilita diversas customizações para o processo de instalação e atualização da aplicação, inclusive atualização de novas versões de forma extremamente prática (conforme mostrado aqui no meu blog).</p>
<p>E agora, um novo novo produto/serviço aparece no mercado. O Adobe Shibuya, ainda beta e não liberado para o uso, mas para quem vem desenvolvendo e utilizando o AIR pode ficar ainda mais animado com a tecnologia.</p>
<p>A proposta do Adobe Shibuya é que em poucas linhas de código você possa criar um controle de distribuição de aplicações em AIR. De que forma? Try e Buy!! Ou seja, versões demo e opção para compra da sua aplicação direto pelo site da Adobe &#8211; veja a loja online <a href="http://www.adobe.com/cfusion/marketplace/index.cfm?event=marketplace.categories&#038;marketplaceId=1&#038;categoryid=10080" target="_new">aqui</a>.</p>
<p>Você irá ter um controle de compras através do Adobe Developer Connection e receberá os pagamentos uma vez por mês. </p>
<p>Bom, a idéia é ótima e só tende a aumentar a quantia de projetos em AIR. Eu particularmente adorei a idéia de poder desenvolver algo e por para vender direto no site da Adobe. <img src='http://www.horochovec.com.br/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Para acompanhar o Shibuya, clique <a href="http://labs.adobe.com/technologies/shibuya/" target="_new">aqui</a>.</p>
<p>Vida longa ao Flex!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/10/15/adobe-shibuya/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR &#8211; Criando uma aplicação com atualização automática &#8211; Parte III</title>
		<link>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-iii/</link>
		<comments>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-iii/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 05:36:52 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Auto-Update]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=168</guid>
		<description><![CDATA[Na última parte do artigo, a última configuração que deve ser feita dentro do projeto, é que dentro da pasta src, você deve criar um arquivo chamado update-config.xml. Esse arquivo irá conter as informações de como o processo de atualização deve se comportar. ?Download update-config.xml1 2 3 4 5 6 7 8 9 10 11 [...]]]></description>
			<content:encoded><![CDATA[<p>Na última parte do artigo, a última configuração que deve ser feita dentro do projeto, é que dentro da pasta <em>src</em>, você deve criar um arquivo chamado <em>update-config.xml.</em> Esse arquivo irá conter as informações de  como o processo de atualização deve se comportar.</p>
<p><span id="more-168"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=168&amp;download=update-config.xml">update-config.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16819"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code" id="p168code19"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;</span>configuration xmlns=<span style="color: #990000;">&quot;http://ns.adobe.com/air/framework/update/configuration/1.0&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>url<span style="color: #000066; font-weight: bold;">&gt;</span>http<span style="color: #000066; font-weight: bold;">:</span><span style="color: #009900; font-style: italic;">//www.seusite.com.br/air/update-config.xml&lt;/url&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>delay<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">&lt;/</span>delay<span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>defaultUI<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>dialog <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;checkForUpdate&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>dialog <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;downloadUpdate&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>dialog <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;downloadProgress&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>dialog <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;installUpdate&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>dialog <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;fileUpdate&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>dialog <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;unexpectedError&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;true&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>defaultUI<span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>configuration<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Todas as opções foram marcadas como true, para que você possa acompanhar todas as etapas do processo.</p>
<p>A partir deste momento, o trabalho fica todo por conta do Flex. Não há mais necessidade de você se preocupar com nada. Ele será responsável por fazer a verificação, sugerir ou não o download, e caso o usuário opte por baixar a aplicação, ainda irá sou salva-lá em seu HD, ou atualizar automaticamente a aplicação. Fácil não é?</p>
<p>Mas como ele sabe que existe uma nova versão para ser baixada?</p>
<p>Através de um arquivo XML que deverá ser publicado no servidor na mesma URL foi informada na propriedade URL do objeto <em>autoUpdater</em>.</p>
<p>Vamos dar uma conferida em como deve ser esse XML para que o autoUpdater possa fazer as verificações necessárias.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=168&amp;download=update-config.xml">update-config.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16820"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p168code20"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>  
<span style="color: #000066; font-weight: bold;">&lt;</span>update xmlns=<span style="color: #990000;">&quot;http://ns.adobe.com/air/framework/update/description/1.0&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>  
	<span style="color: #000066; font-weight: bold;">&lt;</span>version<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">1.1</span><span style="color: #000066; font-weight: bold;">&lt;/</span>version<span style="color: #000066; font-weight: bold;">&gt;</span>  
	<span style="color: #000066; font-weight: bold;">&lt;</span>url<span style="color: #000066; font-weight: bold;">&gt;</span>http<span style="color: #000066; font-weight: bold;">:</span><span style="color: #009900; font-style: italic;">//www.seusite.com.br/air/AIRAutoUpdate1-1.air&lt;/url&gt;  </span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>description<span style="color: #000066; font-weight: bold;">&gt;&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>   
	v1<span style="color: #000066; font-weight: bold;">.</span>1
	<span style="color: #000066; font-weight: bold;">*</span> Adicionado novos feeds para leitura
	<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;&lt;/</span>description<span style="color: #000066; font-weight: bold;">&gt;</span>  
<span style="color: #000066; font-weight: bold;">&lt;/</span>update<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Simples não é? Poucas informações são necessárias para que a atualização ocorra. Você deve informar apenas a versão da aplicação que deverá ser atualizada. Ou seja, minha primeira compilação da primeira versão do projeto era 1.0, a próxima versão, ela foi compilada como 1.1, então é essa versão que eu devo passar para o update-config.xml.</p>
<p>Depois, devo informar a URL que está o arquivo que deverá ser feito o download para  a atualização. E por ultimo, posso descrever quais foram as alterações na versão que geraram a nova atualização.</p>
<p>Dessa forma, quando iniciarmos a aplicação, o aplicativo irá ler esse XML, verificará que existe uma nova versão disponível, e irá inicializar o processo de atualização.</p>
<p>De uma forma simples assim, você não precisará mais se preocupar com atualizadores ou em informar seu cliente que existe uma nova versão para o sistema. Deixe o AIR trabalhar um pouco por você!</p>
<p>Com os códigos informados acima, temos a primeira versão do sistema completa, exceto o XML de atualização, que só deve ser publicado quando houver uma nova versão. Abaixo, seguem os fontes para a versão 1.1 do projeto. Esses sem comentários adicionais, já que o intuito do artigo era apenas explicar como é feita a atualização de forma automática em aplicações em AIR.</p>
<p><strong>AIRAutoUpdate-app.xml</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=168&amp;download=AIRAutoUpdate-app.xml">AIRAutoUpdate-app.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16821"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p168code21"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/air/application/1.5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AIRAutoUpdate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filename<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AIRAutoUpdate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filename<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AIRAutoUpdate - Tutorial IMasters<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;installFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Horochovec/AIR/AIRAutoUpdate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/installFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;programMenuFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Horochovec/AIR/AIRAutoUpdate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/programMenuFolder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Exemplo de app que faz sua atualização automática<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copyright<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Stefan Horochovec (stefan@horochovec.com.br)<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copyright<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;initialWindow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AIRAutoUpdate<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AIRAutoUpdate.swf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;systemChrome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>none<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/systemChrome<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;transparent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/transparent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;visible<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/visible<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;minimizable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/minimizable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;maximizable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/maximizable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resizable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resizable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/initialWindow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>Posts.mxml</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=168&amp;download=AIRAutoUpdate-app.xml">AIRAutoUpdate-app.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16822"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
</pre></td><td class="code" id="p168code22"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TitleWindow 
	xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> 
	layout=<span style="color: #990000;">&quot;absolute&quot;</span> 
	<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;500&quot;</span> 
	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;250&quot;</span> 
	showCloseButton=<span style="color: #990000;">&quot;true&quot;</span> 
	creationComplete=<span style="color: #990000;">&quot;creationCompleteHandler(event);&quot;</span>
	<span style="color: #004993;">close</span>=<span style="color: #990000;">&quot;onCloseHandler(event);&quot;</span> 
	title=<span style="color: #990000;">&quot;Feeds Imasters - Seção Flex&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">import</span> flash<span style="color: #000066; font-weight: bold;">.</span>desktop<span style="color: #000066; font-weight: bold;">.</span>NativeApplication<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>CloseEvent<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>FlexEvent<span style="color: #000066; font-weight: bold;">;</span>			
			<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>ResultEvent<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Dataprovider do grid
			 */</span>			
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> xmlList <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=xmllist%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xmllist.html"><span style="color: #004993;">XMLList</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento disparado na finalização da construção do componente
    		 * Responsavel por iniciar o HTTPService para leitura do feed
    		 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> creationCompleteHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>FlexEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>service<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">send</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Evento disparado no termino com sucesso da leitura do HTTPService
			 * Responsavel por adicionar ao grid o dataProvider
			 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> serviceHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ResultEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> result <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a><span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span>result<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				xmlList	= result<span style="color: #000066; font-weight: bold;">..</span>item<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= xmlList<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento disparado no fechar da TitleWindow, ele é responsável por fechar a aplicação
    		 */</span>			
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onCloseHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>CloseEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
			<span style="color: #000000;">&#123;</span>
				NativeApplication<span style="color: #000066; font-weight: bold;">.</span>nativeApplication<span style="color: #000066; font-weight: bold;">.</span>exit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Quando ocorrer um click no grid, o botao para abrir o link do post
			 * sera habilitado, e coloca os textos para os componentes do autor 
			 * e descrição do post
			 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onClickGridHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>btnLink<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span>	= <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autor<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span>			= <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>selectedItem<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">'author'</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>descricao<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span>		= <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>selectedItem<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">'description'</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Click do botao para visualizar o artigo
			 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onBtnLinkClickHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>selectedItem<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">'guid'</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;_blank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>HTTPService id=<span style="color: #990000;">&quot;service&quot;</span> <span style="color: #004993;">url</span>=<span style="color: #990000;">&quot;http://imasters.uol.com.br/feed/secao/flex&quot;</span> 
					showBusyCursor=<span style="color: #990000;">&quot;true&quot;</span> resultFormat=<span style="color: #990000;">&quot;e4x&quot;</span> 
					result=<span style="color: #990000;">&quot;serviceHandler(event)&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>AdvancedDataGrid id=<span style="color: #990000;">&quot;grid&quot;</span> designViewDataType=<span style="color: #990000;">&quot;flat&quot;</span> 
							 <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span> 
							 <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
							 <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onClickGridHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
				<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>AdvancedDataGridColumn headerText=<span style="color: #990000;">&quot;Titulo do artigo&quot;</span> dataField=<span style="color: #990000;">&quot;title&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>AdvancedDataGrid<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas 	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">borderColor</span>=<span style="color: #990000;">&quot;#DADADA&quot;</span> borderStyle=<span style="color: #990000;">&quot;solid&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;6&quot;</span> id=<span style="color: #990000;">&quot;autor&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextArea 	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;53&quot;</span> id=<span style="color: #990000;">&quot;descricao&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;6&quot;</span> 
							borderStyle=<span style="color: #990000;">&quot;none&quot;</span> <span style="color: #004993;">selectable</span>=<span style="color: #990000;">&quot;false&quot;</span> mouseFocusEnabled=<span style="color: #990000;">&quot;false&quot;</span> 
							<span style="color: #004993;">mouseEnabled</span>=<span style="color: #990000;">&quot;false&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>LinkButton 	<span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;383&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;4&quot;</span> label=<span style="color: #990000;">&quot;Ler artigo&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;false&quot;</span> 
							id=<span style="color: #990000;">&quot;btnLink&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onBtnLinkClickHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>TitleWindow<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Espero ter ficado claro o processo de atualização automática no AIR.</p>
<p>Abraços a todos.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-iii/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>AIR &#8211; Criando uma aplicação com atualização automática &#8211; Parte II</title>
		<link>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-ii/</link>
		<comments>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-ii/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 05:32:26 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Auto-Update]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=145</guid>
		<description><![CDATA[Segunda parte&#8230; Na continuação podemos partir para o desenvolvimento da aplicação em si. Eu criei um componente chamado Posts.mxml, ele encontra-se dentro da package: br.com.horochovec.view.Posts. A idéia desse componente é que ele seja responsável por consumir o Feed sobre Flex do site iMasters, passe algumas informações para um Grid, e assim, o usuário possa listar [...]]]></description>
			<content:encoded><![CDATA[<p>Segunda parte&#8230;<span id="more-145"></span></p>
<p>Na continuação podemos partir para o desenvolvimento da aplicação em si. Eu criei um componente chamado Posts.mxml, ele encontra-se dentro da package: br.com.horochovec.view.Posts. A idéia desse componente é que ele seja responsável por consumir o Feed sobre Flex do site iMasters, passe algumas informações para um Grid, e assim, o usuário possa listar os posts do site e obter mais informações sobre ele.</p>
<p>Esse componente estende de uma TitleWindow, dentro dele possui um VBox, AdvancedDataGrid, e um Canvas, que contem dentro dele um Label, um TextArea e um LinkButton.</p>
<p>O componente VBox é o container que agrupará todos os outros componentes visuais desse componente.</p>
<p>Ainda no componente Posts.mxml, eu possuo um HTTPService. Esse HTTPService é responsável por consumir o Feed da iMasters em seu momento de criação. Ou seja, quando o componente Posts.mxml for criado, irá consumir o HTTPService para que busque todos os artigos disponíveis no site na seção Flex. O formato do consumo das informações será através de e4x.</p>
<p>O AdvancedDataGrid tem apenas uma única coluna, ela é responsável por imprimir o titulo do artigo. Caso o usuário opte por clicar no item do Grid, eu solicito para a aplicação que me mostre no quadro abaixo (composto por um Canvas, Label, TextInput e LinkButton) algumas informações do post selecionado.</p>
<p>Segue o fonte na integra do componente desenvolvido.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=145&amp;download=Posts.mxml">Posts.mxml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14525"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
</pre></td><td class="code" id="p145code25"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TitleWindow 
	xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> 
	layout=<span style="color: #990000;">&quot;absolute&quot;</span> 
	<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;500&quot;</span> 
	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;250&quot;</span> 
	showCloseButton=<span style="color: #990000;">&quot;true&quot;</span> 
	creationComplete=<span style="color: #990000;">&quot;creationCompleteHandler(event);&quot;</span>
	<span style="color: #004993;">close</span>=<span style="color: #990000;">&quot;onCloseHandler(event);&quot;</span> 
	title=<span style="color: #990000;">&quot;Feeds Imasters - Seção Flex&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">import</span> flash<span style="color: #000066; font-weight: bold;">.</span>desktop<span style="color: #000066; font-weight: bold;">.</span>NativeApplication<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>CloseEvent<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>FlexEvent<span style="color: #000066; font-weight: bold;">;</span>			
			<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>rpc<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>ResultEvent<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Dataprovider do grid
			 */</span>			
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> xmlList <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=xmllist%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xmllist.html"><span style="color: #004993;">XMLList</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento disparado na finalização da construção do componente
    		 * Responsavel por iniciar o HTTPService para leitura do feed
    		 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> creationCompleteHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>FlexEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>service<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">send</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Evento disparado no termino com sucesso da leitura do HTTPService
			 * Responsavel por adicionar ao grid o dataProvider
			 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> serviceHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ResultEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> result <span style="color: #000066; font-weight: bold;">:</span> <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a><span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span>result<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				xmlList	= result<span style="color: #000066; font-weight: bold;">..</span>item<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>dataProvider	= xmlList<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento disparado no fechar da TitleWindow, ele é responsável por fechar a aplicação
    		 */</span>			
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onCloseHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>CloseEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
			<span style="color: #000000;">&#123;</span>
				NativeApplication<span style="color: #000066; font-weight: bold;">.</span>nativeApplication<span style="color: #000066; font-weight: bold;">.</span>exit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Quando ocorrer um click no grid, o botao para abrir o link do post
			 * sera habilitado, e coloca os textos para os componentes do autor 
			 * e descrição do post
			 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onClickGridHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>btnLink<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span>	= <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autor<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span>			= <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>selectedItem<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">'author'</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>descricao<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span>		= <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>selectedItem<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">'description'</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #3f5fbf;">/**
			 * Click do botao para visualizar o artigo
			 */</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onBtnLinkClickHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span style="color: #004993;">URLRequest</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>grid<span style="color: #000066; font-weight: bold;">.</span>selectedItem<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #990000;">'guid'</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;_blank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>HTTPService id=<span style="color: #990000;">&quot;service&quot;</span> <span style="color: #004993;">url</span>=<span style="color: #990000;">&quot;http://imasters.uol.com.br/feed/secao/flex&quot;</span> 
					showBusyCursor=<span style="color: #990000;">&quot;true&quot;</span> resultFormat=<span style="color: #990000;">&quot;e4x&quot;</span> 
					result=<span style="color: #990000;">&quot;serviceHandler(event)&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>AdvancedDataGrid id=<span style="color: #990000;">&quot;grid&quot;</span> designViewDataType=<span style="color: #990000;">&quot;flat&quot;</span> 
							 <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span> 
							 <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
							 <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onClickGridHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
				<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>AdvancedDataGridColumn headerText=<span style="color: #990000;">&quot;Titulo do artigo&quot;</span> dataField=<span style="color: #990000;">&quot;title&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>AdvancedDataGrid<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas 	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">borderColor</span>=<span style="color: #990000;">&quot;#DADADA&quot;</span> borderStyle=<span style="color: #990000;">&quot;solid&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;6&quot;</span> id=<span style="color: #990000;">&quot;autor&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextArea 	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;53&quot;</span> id=<span style="color: #990000;">&quot;descricao&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;6&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;6&quot;</span> 
							borderStyle=<span style="color: #990000;">&quot;none&quot;</span> <span style="color: #004993;">selectable</span>=<span style="color: #990000;">&quot;false&quot;</span> mouseFocusEnabled=<span style="color: #990000;">&quot;false&quot;</span> 
							<span style="color: #004993;">mouseEnabled</span>=<span style="color: #990000;">&quot;false&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
			<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>LinkButton 	<span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;383&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;4&quot;</span> label=<span style="color: #990000;">&quot;Ler artigo&quot;</span> <span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;false&quot;</span> 
							id=<span style="color: #990000;">&quot;btnLink&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onBtnLinkClickHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Canvas<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>TitleWindow<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Algumas  considerações interessantes sobre o componente acima:</p>
<ul>
<li><strong>creationComplete=&#8221;creationCompleteHandler(event);&#8221;</strong> Quando o  componente tiver sido criado, ele irá disparar a função  creationCompleteHandler(); que será responsável por iniciar o consumo do  HTTPService.</li>
</ul>
<ul>
<li><strong>onCloseHandler(event:CloseEvent);</strong> Neste evento a  classe NativeApplication é acionada sendo responsável por fechar a aplicação  pelo botão de fechar da TitleWindow, componente base para o componente Posts;</li>
</ul>
<ul>
<li><strong>serviceHandler(event:ResultEvent);</strong> Evento responsável  por filtras as informações que o HTTPService consumiu e as retornaram como  string. Essas informações foram passadas para um XMLList aonde este XMLList  será o dataProvider do Grid.</li>
</ul>
<p>Com isso temos um componente  baseado em uma TitleWindow, que é capaz de buscar informações de um feed do  site da iMasters, através de HTTPService e disponibilizar as informações na  tela.</p>
<p>Dentro da minha aplicação  principal, eu possuo a definição de alguns estilos, para que o fundo transparente  funcione sem nenhum transtorno.</p>
<p>Para uma melhor interpretação, irei  disponibilizar todo o fonte do main, depois comentando cada uma das observações  necessárias.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=145&amp;download=AIRAutoUpdate.mxml">AIRAutoUpdate.mxml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14526"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
</pre></td><td class="code" id="p145code26"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Application 
	xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span>
	xmlns<span style="color: #000066; font-weight: bold;">:</span>app=<span style="color: #990000;">&quot;br.com.horochovec.view.*&quot;</span> 
    <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;500&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;250&quot;</span>
    layout=<span style="color: #990000;">&quot;absolute&quot;</span>
    paddingRight=<span style="color: #990000;">&quot;0&quot;</span>
    paddingLeft=<span style="color: #990000;">&quot;0&quot;</span> 
    creationComplete=<span style="color: #990000;">&quot;onCreationCompleteHandler(event);&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Style<span style="color: #000066; font-weight: bold;">&gt;</span>
    	<span style="color: #3f5fbf;">/**
    	 * Estilo para a aplicação possuir o background transparente
    	 */</span>
        Application 
        <span style="color: #000000;">&#123;</span>
            background<span style="color: #000066; font-weight: bold;">-</span><span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span> 
            background<span style="color: #000066; font-weight: bold;">-</span>image<span style="color: #000066; font-weight: bold;">:</span><span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span> 
            padding<span style="color: #000066; font-weight: bold;">:</span> 0px<span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Style<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
    	<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
    		<span style="color: #0033ff; font-weight: bold;">import</span> air<span style="color: #000066; font-weight: bold;">.</span>update<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>DownloadErrorEvent<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    		<span style="color: #0033ff; font-weight: bold;">import</span> air<span style="color: #000066; font-weight: bold;">.</span>update<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>UpdateEvent<span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #0033ff; font-weight: bold;">import</span> air<span style="color: #000066; font-weight: bold;">.</span>update<span style="color: #000066; font-weight: bold;">.</span>ApplicationUpdaterUI<span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>Alert<span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>CloseEvent<span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.</span>FlexEvent<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Objeto para atualizacao automatica
    		 */</span>
    		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> autoUpdater	<span style="color: #000066; font-weight: bold;">:</span> ApplicationUpdaterUI = <span style="color: #0033ff; font-weight: bold;">new</span> ApplicationUpdaterUI<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento disparado na finalização da aplicação para adicionar um Listner de MouseDown 
    		 * no componente principal da aplicação
    		 */</span>
    		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onCreationCompleteHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>FlexEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
    		<span style="color: #000000;">&#123;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>main<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_DOWN</span><span style="color: #000066; font-weight: bold;">,</span>	onMouseDownHandler <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdateInit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #000000;">&#125;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Funcao para configuracao do inicio da atualizacao
    		 */</span>
    		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> autoUpdateInit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
    		<span style="color: #000000;">&#123;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdater<span style="color: #000066; font-weight: bold;">.</span>updateURL	= <span style="color: #990000;">&quot;http://www.horochovec.com.br/air/update-config.xml&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdater<span style="color: #000066; font-weight: bold;">.</span>isCheckForUpdateVisible	= <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdater<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>UpdateEvent<span style="color: #000066; font-weight: bold;">.</span>INITIALIZED<span style="color: #000066; font-weight: bold;">,</span>	onUpdateApp<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdater<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=errorevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:errorevent.html"><span style="color: #004993;">ErrorEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ERROR</span><span style="color: #000066; font-weight: bold;">,</span>			onErrorUpdate<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdater<span style="color: #000066; font-weight: bold;">.</span>initialize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #000000;">&#125;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento de inicializacao de atualizacao
    		 */</span>
    		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onUpdateApp<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>UpdateEvent<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> 
    		<span style="color: #000000;">&#123;</span>
    			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>autoUpdater<span style="color: #000066; font-weight: bold;">.</span>checkNow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #000000;">&#125;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Evento em caso de erro na atualizacao
    		 */</span>
    		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onErrorUpdate<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=errorevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:errorevent.html"><span style="color: #004993;">ErrorEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
    		<span style="color: #000000;">&#123;</span>
    			Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #000000;">&#125;</span>
&nbsp;
    		<span style="color: #3f5fbf;">/**
    		 * Possibilita arrastar o componente na janela atual 
    		 */</span>
    		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onMouseDownHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
    		<span style="color: #000000;">&#123;</span>
    			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span>nativeWindow<span style="color: #000066; font-weight: bold;">.</span>startMove<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    		<span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
    	<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
    <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">&lt;!--</span> Componente com a aplicação <span style="color: #000066; font-weight: bold;">--&gt;</span>
    <span style="color: #000066; font-weight: bold;">&lt;</span>app<span style="color: #000066; font-weight: bold;">:</span>Posts <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0&quot;</span> id=<span style="color: #990000;">&quot;main&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Application<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Algumas  considerações:</p>
<ul>
<li><strong>creationComplete=&#8221;onCreationCompleteHandler(event);&#8221;</strong> No termino da criação da aplicação, a função onCreationCompleteHandler() será disparada, ela é responsável por adicionar um EventListner de MouseDown em meu componente Posts, e também executa a função autoUpdateInit(), que será responsável por eu iniciar meu objeto de atualização automática;</li>
</ul>
<ul>
<li><strong>function autoUpdateInit();</strong>Nessa função ocorre a configuração do objeto para efetuar a atualização automática. O primeiro atributo informado é a URL do arquivo XML que será consultado para verificar se existe uma atualização disponível para a aplicação (o formato do arquivo será informado na sequência).O segundo atributo informado é para que seja visível a busca por novas atualizações, esse atributo está informado como <em>true</em>, para que possamos acompanhar a busca por novas atualizações e ver se realmente está funcionando a implementação.Em seguida, dois <em>EventListner</em> são adicionados ao objeto, um quando ele for inicializado, e outro caso aconteça algum erro.Por fim, a função inicializa o objeto de atualização através da função <em>initialize();</em></li>
</ul>
<ul>
<li><strong>function initialize();</strong> Essa função é responsável por solicitar ao componente de atualização que verifique na URL informada se o aplicativo possui uma versão nova.</li>
</ul>
<p>Dessa forma, terminamos a segunda parte do artigo. Até a próxima!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR &#8211; Criando uma aplicação com atualização automática &#8211; Parte I</title>
		<link>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-i/</link>
		<comments>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-i/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 05:28:49 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Auto-Update]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=139</guid>
		<description><![CDATA[Ola pessoal, Esse e os próximos dois posts no meu blog irei abordar um assunto que considero bastante interessante e que a Adobe teve um cuidado todo especial quando projetou essa atualização no SDK 1.5 do AIR, que foi a API para uma auto-atualização de sua aplicação. Esse artigo será divido em três partes. Os [...]]]></description>
			<content:encoded><![CDATA[<p>Ola pessoal,</p>
<p>Esse e os próximos dois posts no meu blog irei abordar um assunto que considero bastante interessante e que a Adobe teve um cuidado todo especial quando projetou essa atualização no SDK 1.5 do AIR, que foi a API para uma auto-atualização de sua aplicação. Esse artigo será divido em três partes. Os códigos fontes dos dois projetos utilizados estão disponíveis para download..</p>
<p>O post foi dividido em três partes devido a seu tamanho, seria muito extenso tudo em um unico.</p>
<p>Espero que aproveitem <img src='http://www.horochovec.com.br/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><span id="more-139"></span></p>
<p>Hoje é possível que você  configure sua aplicação para que ela procure no servidor se existe uma  atualização disponível e caso exista, se você quer fazer o download e atualizar  sua aplicação. Ainda é possível que você possa informar ao usuário do sistema,  quais seriam os motivos para a atualização da aplicação. Tudo isso, através de poucas  linhas de codificação e apenas um arquivo XML em seu servidor.</p>
<p>Para ilustrar essa situação,  vamos criar uma aplicação que irá ler um feed do site da iMasters. A  primeira versão da aplicação será responsável por ler apenas um dos feeds, e a  sua atualização, poderá ter mais opções de leitura.</p>
<p>Vou iniciar o artigo, partindo do  principio que você já saiba criar um projeto no FlexBuilder para AIR. Essa  aplicação tem alguns detalhes interessantes. O primeiro deles é que ela terá  seu background transparente, ou seja, você tem a impressão que a aplicação está  rodando como um gadget, outra grande inovação que a Adobe trouxe para o AIR.</p>
<p>Eu criei um projeto chamado <strong>AIRAutoUpdate</strong> e o FlexBuilder criou a  estrutura abaixo:</p>
<p><img class="aligncenter size-full wp-image-140" title="imagem01" src="http://www.horochovec.com.br/blog/wp-content/uploads/2009/08/imagem01.jpg" alt="imagem01" width="297" height="224" /></p>
<p>Bom, para quem não conhece a estrutura do AIR, o arquivo AIRAutoUpdate-app.xml é responsável por definir diversas informações ao compilador. O FlexBuilder adiciona um arquivo bem extenso quando você cria um projeto, iremos substituir o arquivo que ele criou por uma versão mais simples, contendo apenas aquilo que for relevante para esse tutorial, conforme informado abaixo:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=139&amp;download=download.txt">download.txt</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13928"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p139code28"><pre class="language" style="font-family:monospace;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;application xmlns=&quot;http://ns.adobe.com/air/application/1.5&quot;&gt;
	&lt;id&gt;AIRAutoUpdate&lt;/id&gt;
	&lt;version&gt;1.0&lt;/version&gt;
	&lt;filename&gt;AIRAutoUpdate&lt;/filename&gt;
	&lt;name&gt;AIRAutoUpdate - Tutorial&lt;/name&gt;
	&lt;installFolder&gt;Horochovec/AIR/AIRAutoUpdate&lt;/installFolder&gt;
	&lt;programMenuFolder&gt;Horochovec/AIR/AIRAutoUpdate&lt;/programMenuFolder&gt;
	&lt;description&gt;Exemplo de app que faz sua atualização automática&lt;/description&gt;
    &lt;copyright&gt;Stefan Horochovec (stefan@horochovec.com.br)&lt;/copyright&gt;
	&lt;initialWindow&gt;
		&lt;title&gt;AIRAutoUpdate&lt;/title&gt;
		&lt;content&gt;AIRAutoUpdate.swf&lt;/content&gt;
		&lt;systemChrome&gt;none&lt;/systemChrome&gt;
		&lt;transparent&gt;true&lt;/transparent&gt;
		&lt;visible&gt;true&lt;/visible&gt;
	    &lt;minimizable&gt;true&lt;/minimizable&gt;
	    &lt;maximizable&gt;false&lt;/maximizable&gt;
	    &lt;resizable&gt;false&lt;/resizable&gt;
	&lt;/initialWindow&gt;
&lt;/application&gt;</pre></td></tr></table></div>

<p>Esse artigo não tem como objetivo descrever todas as informações que foram atribuídas ao XML, porem, algumas ressalvas serão feitas aos atributos que são base para esse artigo.</p>
<ol>
<li><strong>&lt;version&gt;&lt;/version&gt; </strong>Utilizado para definir qual a versão da aplicação atualmente, é usado para fazer verificações de versão para atualização.</li>
<li><strong>&lt;systemChrome&gt;none&lt;/systemChrome&gt; </strong>Definição do tipo do System Chrome, essa opção tem valor default “standard”, porem, para criar uma aplicação com fundo transparente, deve-se atribuir o valor “none”.</li>
<li><strong>&lt;transparent&gt;true&lt;/transparent&gt; </strong>Definição se a janela deverá ser transparente, é apenas aplicável quando systemChrome for do tipo none.</li>
<li><strong>&lt;visible&gt;true&lt;/visible&gt; </strong>Define se a janela deverá se iniciar como visível, como o valor default é false, passamos para true.</li>
</ol>
<p>Assim,  dessa forma o compilador irá receber as informações necessárias a nível de  definição da aplicação para que o seu background fique transparente.</p>
<p>Terminamos assim, a primeira parte do artigo, até a proxima.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/08/14/air-criando-uma-aplicacao-com-atualizacao-automatica-parte-i/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Curso Adobe Flex &#8211; Básico ao Avançado</title>
		<link>http://www.horochovec.com.br/blog/2009/07/24/curso-adobe-flex-basico-ao-avancado/</link>
		<comments>http://www.horochovec.com.br/blog/2009/07/24/curso-adobe-flex-basico-ao-avancado/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 04:03:14 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=136</guid>
		<description><![CDATA[Ola pessoal. Estarei ministrando um curso de Adobe Flex em parceria com o NTI &#8211; Paraná. O curso terá 24 horas de duração e serão abordados diversos conteudos sobre Adobe Flex. Iremos desenvolver uma aplicação durante o curso que irá consumir serviços Java para persistência de informações. Para mais informações, acesse o site do NTI [...]]]></description>
			<content:encoded><![CDATA[<p>Ola pessoal.</p>
<p>Estarei ministrando um curso de Adobe Flex em parceria com o NTI &#8211; Paraná. O curso terá 24 horas de duração e serão abordados diversos conteudos sobre Adobe Flex. Iremos desenvolver uma aplicação durante o curso que irá consumir serviços Java para persistência de informações.</p>
<p>Para mais informações, acesse o site do NTI Paraná, clicando <a href="http://www.ntipr.org.br/" target="_new">aqui</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/07/24/curso-adobe-flex-basico-ao-avancado/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Remover componentes do Custom do FlexBuilder</title>
		<link>http://www.horochovec.com.br/blog/2009/07/23/remover-componentes-do-custom-do-flexbuilder/</link>
		<comments>http://www.horochovec.com.br/blog/2009/07/23/remover-componentes-do-custom-do-flexbuilder/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 02:49:44 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[SDK]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=128</guid>
		<description><![CDATA[Olá, É muito comum no Flex o programador criar componentes para facilitar sua vida, porém, nem sempre você tem a necessidade de criar uma Library para isso, ou seja, você acaba customizando componentes dentro da sua própria aplicação. Porém, em algumas situações, você pode criar um componente &#8220;pai&#8221; e alguns &#8220;filhos&#8221;, usando a herança. Geralmente [...]]]></description>
			<content:encoded><![CDATA[<p>Olá,</p>
<p>É muito comum no Flex o programador criar componentes para facilitar sua vida, porém, nem sempre você tem a necessidade de criar uma Library para isso, ou seja, você acaba customizando componentes dentro da sua própria aplicação. Porém, em algumas situações, você pode criar um componente &#8220;pai&#8221; e alguns &#8220;filhos&#8221;, usando a herança. Geralmente nesses casos você só usa na sua aplicação os componentes &#8220;filhos&#8221;, o componente &#8220;pai&#8221; é a base para eles e ele não deve ser utilizado em sua aplicação. Agora, como remover ele de sua aba &#8220;Custom&#8221; no FlexBuilder?</p>
<p><span id="more-128"></span>Existe uma forma simples de fazer isso, você fará o uso da metadata <strong>ExcludeClass</strong>.</p>
<p>Para exemplificar essa situação, iremos criar a seguinte situação. Um componente base que eu devo usar para os botões da minha aplicação, e depois, iremos criar um botão para o uso na aplicação. Vale lembrar que essa situação é apenas para ilustrar o uso da metadata e não é um padrão para criação de botões, até porque o componente pai irá herdar suas propriedades de um Canvas.</p>
<p>Segue abaixo, o código fonte do componente principal: Botao</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=128&amp;download=Botao.as">Botao.as</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12832"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p128code32"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> br<span style="color: #000066; font-weight: bold;">.</span>com<span style="color: #000066; font-weight: bold;">.</span>horochovec
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>containers<span style="color: #000066; font-weight: bold;">.</span>Canvas<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Botao <span style="color: #0033ff; font-weight: bold;">extends</span> Canvas
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Botao<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Feito isso, iremos criar um novo componentes, que iremos chamar de BotaoOK:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=128&amp;download=BotaoOK.as">BotaoOK.as</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12833"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p128code33"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> br<span style="color: #000066; font-weight: bold;">.</span>com<span style="color: #000066; font-weight: bold;">.</span>horochovec
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> br<span style="color: #000066; font-weight: bold;">.</span>com<span style="color: #000066; font-weight: bold;">.</span>horochovec<span style="color: #000066; font-weight: bold;">.</span>Botao<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> BotaoOK <span style="color: #0033ff; font-weight: bold;">extends</span> Botao
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> BotaoOK<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Dessa forma, teremos o componente BotaoOK pronto para o uso, porém, no grupo &#8220;Custom&#8221; de meus componentes no FlexBuilder, eu tenho também disponivel para o uso o componente Botao, que é o componente pai, e eu não quero utilizá-lo em meu projeto. Quero removê-lo da lista, para que nenhum desenvolvedor utilize o mesmo. Como devo proceder?</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.horochovec.com.br/blog/wp-content/plugins/wp-codebox/wp-codebox.php?p=128&amp;download=Botao.as">Botao.as</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12834"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p128code34"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> br<span style="color: #000066; font-weight: bold;">.</span>com<span style="color: #000066; font-weight: bold;">.</span>horochovec
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>containers<span style="color: #000066; font-weight: bold;">.</span>Canvas<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #000000;">&#91;</span>ExcludeClass<span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Botao <span style="color: #0033ff; font-weight: bold;">extends</span> Canvas
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Botao<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Pronto. Adicionando a Metadata [ExcludeClass] dentro do seu componente, ele não estará mais disponivel para o uso em minha aplicação, mas poderei continuar usando o componente pai para ser base de outros componentes.</p>
<p>Espero ter contribuido,</p>
<p>Abraços, dúvidas? Comentem!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/07/23/remover-componentes-do-custom-do-flexbuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flexmania 2009 &#8211; Apresentação disponivel</title>
		<link>http://www.horochovec.com.br/blog/2009/07/08/flexmania-2009-apresentacao-disponivel/</link>
		<comments>http://www.horochovec.com.br/blog/2009/07/08/flexmania-2009-apresentacao-disponivel/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 21:50:25 +0000</pubDate>
		<dc:creator>Stefan Horochovec</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flexmania]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.horochovec.com.br/blog/?p=123</guid>
		<description><![CDATA[Ola pessoal! Já estão disponiveis as apresentações da Flexmania 2009! Para conferir o link para todas as apresentações clique aqui. Para assistir a minha palestra novamente, clique aqui, e para baixar os os projetos e minha apresentação de slides, clique aqui. Obrigado novamente a todos que compareceram ao evento e a minha palestra]]></description>
			<content:encoded><![CDATA[<p>Ola pessoal!</p>
<p>Já estão disponiveis as apresentações da Flexmania 2009! Para conferir o link para todas as apresentações clique <a href="http://www.flexmania.com.br/" target="_new">aqui</a>.</p>
<p>Para assistir a minha palestra novamente, clique <a href="http://experts.na3.acrobat.com/p43706438/" target="_new">aqui</a>, e para baixar os os projetos e minha apresentação de slides, clique <a href="http://rapidshare.com/files/253563087/Flexmania.zip.html" target="_new">aqui</a>.</p>
<p>Obrigado novamente a todos que compareceram ao evento e a minha palestra <img src='http://www.horochovec.com.br/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.horochovec.com.br/blog/2009/07/08/flexmania-2009-apresentacao-disponivel/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
