﻿<?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>Armando Leopoldo Keller &#187; AIR</title>
	<atom:link href="http://armandokeller.com/blog/tag/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://armandokeller.com/blog</link>
	<description>Actionscript, AIR, Python, Engenharia Elétrica....</description>
	<lastBuildDate>Tue, 24 Jan 2012 19:26:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>De Monster Debugger &#8211; como utilizar</title>
		<link>http://armandokeller.com/blog/2009/05/de-monster-debugger-como-utilizar/</link>
		<comments>http://armandokeller.com/blog/2009/05/de-monster-debugger-como-utilizar/#comments</comments>
		<pubDate>Sat, 02 May 2009 21:11:48 +0000</pubDate>
		<dc:creator>Armando Leopoldo Keller</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[flash player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Monster Debugger]]></category>
		<category><![CDATA[Trace]]></category>

		<guid isPermaLink="false">http://armandokeller.com/blog/?p=59</guid>
		<description><![CDATA[Exemplo rapido de como utilizar o MonsterDebugger.]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://armandokeller.com/blog/2009/05/de-monster-debugger-como-utilizar/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script>
			<!-- 
			var fbShare = {
				url: "http://armandokeller.com/blog/2009/05/de-monster-debugger-como-utilizar/",
				size: "large",
				google_analytics: "true"
			}
			//-->
			</script>
                        <script src="http://widgets.fbshare.me/files/fbshare.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript"><!-- 
		(function() {
		var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
		s.type = 'text/javascript';
		s.async = true;
		s.src = 'http://widgets.digg.com/buttons.js';
		s1.parentNode.insertBefore(s, s1);
		})();
		//-->
		</script><a class="DiggThisButton " href="http://digg.com/submit?url=http%3A%2F%2Farmandokeller.com%2Fblog%2F2009%2F05%2Fde-monster-debugger-como-utilizar%2F"></a></div><div class="socialize-in-button socialize-in-button-vertical"><div class="delicious-button"><div class="del-top"><span id="59">0</span>saves</div><div class="del-bot"><a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">Save</a></div></div>
		<script>
			<!-- 
			function displayURL(data) { var urlinfo = data[0]; if (!urlinfo.total_posts) return;document.getElementById('59').innerHTML = urlinfo.total_posts;}
			//-->
		</script>
		<script src = "http://badges.del.icio.us/feeds/json/url/data?url=http://armandokeller.com/blog/2009/05/de-monster-debugger-como-utilizar/&amp;callback=displayURL"></script></div></div><p>Faz tempo que eu não posto nada, devido a falta de tempo , e de ideias sobre o que postar.<br />
Hoje, resolvi postar sobre como utilizar o MonsterDebugger, o melhor debugger que eu ja vi para actionscript.</p>
<p>Primeiro, o que é esse MonsterDebugger ?<br />
O <a href="http://demonsterdebugger.com/">MonsterDebugger ( http://demonsterdebugger.com/ )</a>  é um debugger Open Source feito em AIR, que permite debugar aplicaçoes Actionscript (flash, flex, air &#8230;), não só dando trace, mas podendo editar as propriedades dos objetos em tempo real, e podendo executar os metodos dos objetos quando quiser. Alem de claro, dar trace nas coisas (se for algum array, xml, objeto &#8230;  ele apresenta o conteudo em arvore, assim fica mais facil de debuggar).</p>
<p>Agora sim, vou mostrar como se usa ele.</p>
<p>1 &#8211; Instale o client:<br />
Va em <a href="http://demonsterdebugger.com/">http://demonsterdebugger.com/</a> , pegue a versão mais recente do MonsterDebugger e instale ele no seu computador. </p>
<p>2 &#8211; Gere as classes necessarias:<br />
Abra o client (instalado anteriormente) e va em File -> Export Client Class<br />
<img src="http://armandokeller.com/blog/imagens/exportar-classe-cliente.jpg" alt="Exportar Classe Cliente - MonsterDebugger" /></p>
<p>3 &#8211; Se quiser pode gerar um exemplo (File -> Export example), ou pode tentar usar direto sem o exemplo.</p>
<p>Como dar um simples Trace:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">MonsterDebugger<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> o_que_é_para_ir_no_trace<span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

<p>Como ativar o live application:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> _debugger<span style="color: #000066; font-weight: bold;">:</span>MonsterDebugger<span style="color: #000066; font-weight: bold;">;</span>
_debugger = <span style="color: #0033ff; font-weight: bold;">new</span> MonsterDebugger<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>A parte de utilizar o Client é bem intuitiva, caso alguem tenha duvidas de como utilizar, favor me avisar que eu coloco aqui detalhadamente como utilizar.</p>
<p>Lembrando que aceito sugestoes de posts, é só entrar em contato.</p>
]]></content:encoded>
			<wfw:commentRss>http://armandokeller.com/blog/2009/05/de-monster-debugger-como-utilizar/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Classe para utilização de SQL em AIR (Flash, Flex)</title>
		<link>http://armandokeller.com/blog/2008/04/classe-para-utilizacao-de-sql-em-air-flash-flex/</link>
		<comments>http://armandokeller.com/blog/2008/04/classe-para-utilizacao-de-sql-em-air-flash-flex/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 22:42:27 +0000</pubDate>
		<dc:creator>Armando Leopoldo Keller</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Flash geral]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[AS 3]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://alkeller.wordpress.com/?p=12</guid>
		<description><![CDATA[0savesSave Neste tutorial mostrarei como utilizar uma classe que eu criei para facilitar o uso de SQL em AIR (tanto para flash quanto para flex) A classe é esta: 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 [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://armandokeller.com/blog/2008/04/classe-para-utilizacao-de-sql-em-air-flash-flex/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script>
			<!-- 
			var fbShare = {
				url: "http://armandokeller.com/blog/2008/04/classe-para-utilizacao-de-sql-em-air-flash-flex/",
				size: "large",
				google_analytics: "true"
			}
			//-->
			</script>
                        <script src="http://widgets.fbshare.me/files/fbshare.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript"><!-- 
		(function() {
		var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
		s.type = 'text/javascript';
		s.async = true;
		s.src = 'http://widgets.digg.com/buttons.js';
		s1.parentNode.insertBefore(s, s1);
		})();
		//-->
		</script><a class="DiggThisButton " href="http://digg.com/submit?url=http%3A%2F%2Farmandokeller.com%2Fblog%2F2008%2F04%2Fclasse-para-utilizacao-de-sql-em-air-flash-flex%2F"></a></div><div class="socialize-in-button socialize-in-button-vertical"><div class="delicious-button"><div class="del-top"><span id="12">0</span>saves</div><div class="del-bot"><a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">Save</a></div></div>
		<script>
			<!-- 
			function displayURL(data) { var urlinfo = data[0]; if (!urlinfo.total_posts) return;document.getElementById('12').innerHTML = urlinfo.total_posts;}
			//-->
		</script>
		<script src = "http://badges.del.icio.us/feeds/json/url/data?url=http://armandokeller.com/blog/2008/04/classe-para-utilizacao-de-sql-em-air-flash-flex/&amp;callback=displayURL"></script></div></div><p>Neste tutorial mostrarei como utilizar uma classe que eu criei para facilitar o uso de SQL em AIR (tanto para flash quanto para flex)<br />
A classe é esta:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/*
################################################
#                                              #
#   Classe  : DB (com.alkeller.air.DB)         #
#   Autor   : Armando Leopoldo Keller          #
#   Versão  : 1.0                              #
#   Contato : alksk8@hotmail.com               #
#   Blog    : http://alkeller.wordpress.com    #
#   Documentaçao em breve no blog              #
#                                              #
################################################
------- Deixe os creditos na classe ----------
*/</span>
<span style="color: #9900cc; font-weight: bold;">package</span> com<span style="color: #000066; font-weight: bold;">.</span>alkeller<span style="color: #000066; font-weight: bold;">.</span>air
<span style="color: #000000;">&#123;</span>
	<span style="color: #009900; font-style: italic;">// Imports</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> flash<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">.</span>SQLResult<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> flash<span style="color: #000066; font-weight: bold;">.</span>filesystem<span style="color: #000066; font-weight: bold;">.</span>File<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> flash<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">.</span>SQLStatement<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> flash<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">.</span>SQLConnection<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span>SQLEvent<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span>SQLErrorEvent<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.errors</span><span style="color: #000066; font-weight: bold;">.</span>SQLError<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #009900; font-style: italic;">// Classe;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> DB
	<span style="color: #000000;">&#123;</span>
		<span style="color: #009900; font-style: italic;">// Variaveis utilizadas;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> conectado<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> dbFile<span style="color: #000066; font-weight: bold;">:</span>File
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> conn<span style="color: #000066; font-weight: bold;">:</span>SQLConnection
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> _sqlStatement<span style="color: #000066; font-weight: bold;">:</span>SQLStatement<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> resultado<span style="color: #000066; font-weight: bold;">:</span>SQLResult<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> retornoString<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> retornoObjeto<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">// Funçao Inicia :utilizada para conectar com o banco de dados;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> Inicia<span style="color: #000000;">&#40;</span>_nome<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span>
		<span style="color: #000000;">&#123;</span>
			conn = <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>
			dbFile = File<span style="color: #000066; font-weight: bold;">.</span>applicationStorageDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span>_nome<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;.db&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">try</span>
			<span style="color: #000000;">&#123;</span>
				conn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>dbFile<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				conectado = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Conectado com &quot;</span><span style="color: #000066; font-weight: bold;">+</span>_nome<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;.db&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				retornoString = <span style="color: #990000;">&quot;Conectado com &quot;</span><span style="color: #000066; font-weight: bold;">+</span>_nome<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;.db&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">catch</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">:</span>SQLError<span style="color: #000000;">&#41;</span> 
			<span style="color: #000000;">&#123;</span>
				conectado = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
				retornoString = <span style="color: #990000;">&quot;Falha ao conectar: &quot;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">message</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;<span style="">\n</span>Detalhes: &quot;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">.</span>details<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> retornoString<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #009900; font-style: italic;">// Funçao executeQuery: Utilizada para executar um comando SQL(verificar quais são aceitos pelo AIR);</span>
		<span style="color: #009900; font-style: italic;">// Retorno: SQLResult --&gt; http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/data/SQLResult.html</span>
		<span style="color: #009900; font-style: italic;">// ou  String de erro;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> executeQuery<span style="color: #000000;">&#40;</span>_sql<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>conectado == <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				_sqlStatement = <span style="color: #0033ff; font-weight: bold;">new</span> SQLStatement<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				_sqlStatement<span style="color: #000066; font-weight: bold;">.</span>sqlConnection = conn<span style="color: #000066; font-weight: bold;">;</span>
				_sqlStatement<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = _sql<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">try</span>
				<span style="color: #000000;">&#123;</span>
					_sqlStatement<span style="color: #000066; font-weight: bold;">.</span>execute<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
					resultado = _sqlStatement<span style="color: #000066; font-weight: bold;">.</span>getResult<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
					retornoObjeto = resultado<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0033ff; font-weight: bold;">catch</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">:</span>SQLError<span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					retornoString = <span style="color: #990000;">&quot;Falha ao executar(&quot;</span><span style="color: #000066; font-weight: bold;">+</span>_sql<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;): &quot;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">message</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;<span style="">\n</span>Detalhes: &quot;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">.</span>details<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span> retornoObjeto<span style="color: #000066; font-weight: bold;">?</span>retornoObjeto<span style="color: #000066; font-weight: bold;">:</span>retornoString<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">else</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #990000;">&quot;Não conectado!&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Classe para download: http://paginas.terra.com.br/lazer/alksk8/DB.as</p>
<p>Como utilizar:<br />
1 &#8211; Importe a classe:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// OBS: Aqui é bom verificar se a classe esta no local certo com/alkeller/air/</span>
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>alkeller<span style="color: #000066; font-weight: bold;">.</span>air<span style="color: #000066; font-weight: bold;">.*;</span>
<span style="color: #009900; font-style: italic;">// ou</span>
<span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>alkeller<span style="color: #000066; font-weight: bold;">.</span>air<span style="color: #000066; font-weight: bold;">.</span>DB<span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>2 &#8211; Inicie o banco:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">DB<span style="color: #000066; font-weight: bold;">.</span>Inicia<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;teste&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// sendo que teste é o nome do banco</span></pre></td></tr></table></div>

<p>3 &#8211; Se as tabelas não existirem, crie elas:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">DB<span style="color: #000066; font-weight: bold;">.</span>executeQuery<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;CREATE TABLE IF NOT EXISTS testando (id INTEGER PRIMARY KEY AUTOINCREMENT,nome TEXT,sobrenome TEXT)&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>4.1 &#8211; Execute as Querys que desejar, por exemplo inserir alguns dados:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">DB<span style="color: #000066; font-weight: bold;">.</span>executeQuery<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;INSERT INTO testando (id,nome,sobrenome) VALUES (null,'ARMANDO LEOPOLDO','KELLER')&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>4.2 &#8211; Exemplo de como buscar dados:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> obj<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span> = DB<span style="color: #000066; font-weight: bold;">.</span>executeQuery<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;SELECT * FROM testando&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> obj<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;linha: &quot;</span><span style="color: #000066; font-weight: bold;">+</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> j<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span> <span style="color: #0033ff; font-weight: bold;">in</span> obj<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>j<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;: &quot;</span><span style="color: #000066; font-weight: bold;">+</span>obj<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>j<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Aproveitem a classe <img src='http://armandokeller.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Em breve colocarei aqui este tutorial em video.</p>
]]></content:encoded>
			<wfw:commentRss>http://armandokeller.com/blog/2008/04/classe-para-utilizacao-de-sql-em-air-flash-flex/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>NativeMenu em AIR (flash)</title>
		<link>http://armandokeller.com/blog/2008/03/nativemenu-em-air-flash/</link>
		<comments>http://armandokeller.com/blog/2008/03/nativemenu-em-air-flash/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 21:04:42 +0000</pubDate>
		<dc:creator>Armando Leopoldo Keller</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Flash geral]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[NativeMenu]]></category>
		<category><![CDATA[NativeMenuItem]]></category>

		<guid isPermaLink="false">http://alkeller.wordpress.com/?p=11</guid>
		<description><![CDATA[0savesSave Olá, segue abaixo um exemplo comentado de como utilizar menus(como os da maioria dos softwares) em AIR, é um exemplo básico baseado em tutoriais da Adobe. 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 [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://armandokeller.com/blog/2008/03/nativemenu-em-air-flash/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script>
			<!-- 
			var fbShare = {
				url: "http://armandokeller.com/blog/2008/03/nativemenu-em-air-flash/",
				size: "large",
				google_analytics: "true"
			}
			//-->
			</script>
                        <script src="http://widgets.fbshare.me/files/fbshare.js"></script></div><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript"><!-- 
		(function() {
		var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
		s.type = 'text/javascript';
		s.async = true;
		s.src = 'http://widgets.digg.com/buttons.js';
		s1.parentNode.insertBefore(s, s1);
		})();
		//-->
		</script><a class="DiggThisButton " href="http://digg.com/submit?url=http%3A%2F%2Farmandokeller.com%2Fblog%2F2008%2F03%2Fnativemenu-em-air-flash%2F"></a></div><div class="socialize-in-button socialize-in-button-vertical"><div class="delicious-button"><div class="del-top"><span id="11">0</span>saves</div><div class="del-bot"><a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;">Save</a></div></div>
		<script>
			<!-- 
			function displayURL(data) { var urlinfo = data[0]; if (!urlinfo.total_posts) return;document.getElementById('11').innerHTML = urlinfo.total_posts;}
			//-->
		</script>
		<script src = "http://badges.del.icio.us/feeds/json/url/data?url=http://armandokeller.com/blog/2008/03/nativemenu-em-air-flash/&amp;callback=displayURL"></script></div></div><p>Olá, segue abaixo um exemplo comentado de como utilizar menus(como os da maioria dos softwares) em AIR, é um exemplo básico baseado em tutoriais da Adobe.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/*
Primeiro crie um arquivo novo(air)
crie um campo de texto com o tamanho que desejar
instancie o campo de texto como &quot;texto&quot; (sem as aspas)
cole o codigo a seguir no primeiro frame
*/</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// importa	as classes necessarias</span>
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span>NativeMenu<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span>NativeMenuItem<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span>NativeWindow<span style="color: #000066; font-weight: bold;">;</span>
<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>
&nbsp;
<span style="color: #009900; font-style: italic;">//declara os 2 items do menu</span>
<span style="color: #6699cc; font-weight: bold;">var</span> Menu01<span style="color: #000066; font-weight: bold;">:</span>NativeMenuItem<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> Menu02<span style="color: #000066; font-weight: bold;">:</span>NativeMenuItem<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>NativeWindow<span style="color: #000066; font-weight: bold;">.</span>supportsMenu<span style="color: #000000;">&#41;</span><span style="color: #009900; font-style: italic;">// Se o sistema operacional for windows</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>menu = <span style="color: #0033ff; font-weight: bold;">new</span> NativeMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">//cria o menu</span>
	<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span>nativeWindow<span style="color: #000066; font-weight: bold;">.</span>menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">SELECT</span><span style="color: #000066; font-weight: bold;">,</span> selecionouUmItem<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona um evento de seleção no menu</span>
	Menu01 = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span>nativeWindow<span style="color: #000066; font-weight: bold;">.</span>menu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Primeiro item&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o primeiro item no menu</span>
	Menu01<span style="color: #000066; font-weight: bold;">.</span>submenu = criaSubMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// adiciona o submenu(que vai ser criado logo abaixo) ao primeiro item</span>
	Menu02 = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span>nativeWindow<span style="color: #000066; font-weight: bold;">.</span>menu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Segundo item&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o segundo item no menu</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>NativeApplication<span style="color: #000066; font-weight: bold;">.</span>supportsMenu<span style="color: #000000;">&#41;</span><span style="color: #009900; font-style: italic;">// se o sistema operacionall for mac</span>
<span style="color: #000000;">&#123;</span>
	Menu01 = NativeApplication<span style="color: #000066; font-weight: bold;">.</span>nativeApplication<span style="color: #000066; font-weight: bold;">.</span>menu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Primeiro item&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o primeiro item no menu</span>
	NativeApplication<span style="color: #000066; font-weight: bold;">.</span>nativeApplication<span style="color: #000066; font-weight: bold;">.</span>menu<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">SELECT</span><span style="color: #000066; font-weight: bold;">,</span> selecionouUmItem<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona um evento de seleção no menu</span>
	Menu01<span style="color: #000066; font-weight: bold;">.</span>submenu = criaSubMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// adiciona o submenu(que vai ser criado logo abaixo) ao primeiro item</span>
	Menu02 = NativeApplication<span style="color: #000066; font-weight: bold;">.</span>nativeApplication<span style="color: #000066; font-weight: bold;">.</span>menu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Segundo item&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o segundo item no menu</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> criaSubMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>NativeMenu
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> tmpMenu<span style="color: #000066; font-weight: bold;">:</span>NativeMenu = <span style="color: #0033ff; font-weight: bold;">new</span> NativeMenu<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// cria o submenu do primeiro item</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> MenuNovo<span style="color: #000066; font-weight: bold;">:</span>NativeMenuItem = tmpMenu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Novo&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o item &quot;Novo&quot; ao submenu</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> MenuSalva<span style="color: #000066; font-weight: bold;">:</span>NativeMenuItem = tmpMenu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Salva&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o item &quot;Salva&quot; ao submenu</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> MenuSair<span style="color: #000066; font-weight: bold;">:</span>NativeMenuItem = tmpMenu<span style="color: #000066; font-weight: bold;">.</span>addItem<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> NativeMenuItem<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Sair&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><span style="color: #009900; font-style: italic;">//adiciona o item &quot;Sair&quot; ao submenu</span>
	<span style="color: #0033ff; font-weight: bold;">return</span> tmpMenu<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> selecionouUmItem<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	texto<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">.</span>label <span style="color: #009900; font-style: italic;">// escreve o nome do item selecionado no campo de texto</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Qualquer duvida é só postar que eu respondo.</p>
<p>Assim que sobrar algum tempo por aqui eu postarei um tutorial (bem detalhado) e com os exemplos, de como utilizar um banco de dados local com o AIR.</p>
]]></content:encoded>
			<wfw:commentRss>http://armandokeller.com/blog/2008/03/nativemenu-em-air-flash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

