<?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>TSW - That Should Work Blog &#187; painel</title>
	<atom:link href="http://blog.msdevstudio.net/tag/painel/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.msdevstudio.net</link>
	<description>Flash, Flex, Web e Aplicações Ricas para Internet!</description>
	<lastBuildDate>Tue, 07 Feb 2012 18:30:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Flex/As3 &#8211; Truques e Dicas #11 &#8211; Mass PopUpRemover</title>
		<link>http://blog.msdevstudio.net/2010/03/12/flexas3-truques-e-dicas-11-mass-popupremover/</link>
		<comments>http://blog.msdevstudio.net/2010/03/12/flexas3-truques-e-dicas-11-mass-popupremover/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 13:43:04 +0000</pubDate>
		<dc:creator>Mário Santos</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[mass]]></category>
		<category><![CDATA[painel]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://msdevstudio.com/blog/?p=1312</guid>
		<description><![CDATA[Vou passar esta dica que apesar de não ser 100% fiavel no meu projecto funcionou a 100% e durante a versão beta de 3 meses, os quais foram necessários para rever, corrigir e distribuir a versão final. O meu problema inicial foi ter uma forma de remover todos os meus PopUps abertos na aplicação, o [...]]]></description>
			<content:encoded><![CDATA[<p>Vou passar esta dica que apesar de não ser 100% fiavel no meu projecto funcionou a 100% e durante a versão beta de 3 meses, os quais foram necessários para rever, corrigir e distribuir a versão final.</p>
<p>O meu problema inicial foi ter uma forma de remover todos os meus PopUps abertos na aplicação, o que inicialmente parecia bem simples acabou por se tornar numa curiosa pesquisa. O meu projeto permitiria utilizador fazer um &#8220;lock&#8221; à aplicação para apresentar de novo o painel de login&#8230; mas como a aplicação pode ser usada por varios empregos e como a janela &#8220;overlay&#8221; do login era meia transparente um utilizador terceiro poderia ver dados de telas deixadas abertas pelo empregado anterior.</p>
<p>A solução passava por arranjar uma forma de remover todos os meus popup&#8217;s sem necessidade de existir um controlador para &#8220;gerir&#8221; as janelas abertas.</p>
<p>Se usar o tipico ciclo para percorrer e remover todos os childs da aplicação ele iria acabar por remover também a minha tela de login, os menus, a control bar&#8230; enfim&#8230; muita coisa que eu não queria ver desaparecer&#8230;</p>
<p>Foi então que parti à pesquisa de uma solução e eis a dica, a class SystemManager. <span id="more-1312"></span>Todos os popups sao carregados como childs desta class, eis que tinha descoberto o meu necessário manager e container dos pops. Esta class também contem outros elementos, mas entao como saber quais deles são PopUp&#8217;s ??? Simples, se não for um PopUp nao pode ser removido pelo PopUpManager certo? então basta tentar remover child a child com o PopUpManager e interceptar os erros que vão ocorrer ao remover um child &#8220;nao-popup&#8221;.</p>
<p>Segue a dica:</p>
<p>[coolcode language=actionscript]</p>
<p>import mx.managers.PopUpManager;<br />
import mx.managers.PopUpManagerChildList;</p>
<p>private function closeAll():void{</p>
<p>              var pops:int=systemManager.numChildren;<br />
               while(pops > 1){<br />
                    try {<br />
                    PopUpManager.removePopUp((systemManager.getChildAt(1) as IFlexDisplayObject));<br />
                    pops=systemManager.numChildren;<br />
                    }<br />
                    catch(e:Error) {<br />
                    	trace(&#8220;Error: &#8220;+e.message);<br />
                    	pops=0;<br />
                    }<br />
                    finally {<br />
                    	trace(&#8216;Removed &#8216;+systemManager.getChildAt(1).name)<br />
                    }<br />
                }</p>
<p>            }</p>
<p>[/coolcode]</p>
<p>É  claro que na minha aplicação final isto não pode ser solução&#8230; a solução final passou por criar um simples manager (um simples array resolve) que gere todos os PopUp&#8217;s abertos, mas fica a dica.</p>
<p>Bom, é quase uma inutilidade! :=)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.msdevstudio.net/2010/03/12/flexas3-truques-e-dicas-11-mass-popupremover/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tutorial Action Script 3 &#8211; 015</title>
		<link>http://blog.msdevstudio.net/2010/01/05/tutorial-action-script-3-015/</link>
		<comments>http://blog.msdevstudio.net/2010/01/05/tutorial-action-script-3-015/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 15:09:54 +0000</pubDate>
		<dc:creator>Mário Santos</dc:creator>
				<category><![CDATA[Action Script & MXML]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA's Geral]]></category>
		<category><![CDATA[Serie Tutoriais AS3]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[tutorial AS3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[painel]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://msdevstudio.com/blog/?p=1222</guid>
		<description><![CDATA[Em continuação a série de tutoriais sobre AS3… Hoje vou falar pouco sobre novidades, mas vou apenas apresentar um exemplo pratico de como criar um painel personalizado usando apenas action script  3 e todos os conceitos que aprendemos até agora&#8230; 5.4. Classes, Exemplo Painel personalizado Vamos a um exemplo prático, usando o flex o meu objectivo [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Em continuação a <a style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; color: #f5405b; text-decoration: none; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://msdevstudio.com/blog/category/serie-tutoriais-as3/" target="_blank">série de tutoriais</a> sobre AS3…</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Hoje vou falar pouco sobre novidades, mas vou apenas apresentar um exemplo pratico de como criar um painel personalizado usando apenas action script  3 e todos os conceitos que aprendemos até agora&#8230;</p>
<blockquote>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;"><strong>5.4. Classes, Exemplo Painel personalizado</strong></p>
</blockquote>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Vamos a um exemplo prático, usando o flex o meu objectivo é fazer o seguinte:</p>
<p>Criar um painel personalizado que permita:</p>
<p>–    ser arrastado (drag &amp; drop) na nossa aplicação<br />
–    ter botões de maximizar, minimizar e restaurar<br />
–    Adicionar efeitos de maximizar, minimizar e restaurar.</p>
<p>Vamos aplicar todos os conhecimentos adquiridos anteriormente bem como a utilização de algumas classes nativas de efeitos disponiveis no flex como efeitos que mais à frente falaremos. Este exemplo apenas funcionará no Flex, visto que o AS3 do flash ainda não suporta alguns pontos e classes de efeitos que foram adicionadas no Flex.</p>
<p>Vejam o seguinte código que foi devidamente comentado para perceberem facilmente toda a sua estrutura.<span id="more-1222"></span><br />
[coolcode lang="actionscript"]</p>
<p>package com.msdevstudio<br />
{<br />
//imports necessários ao nosso painel / class<br />
//Eventos</p>
<p>import flash.events.Event;<br />
import flash.events.MouseEvent;</p>
<p>import mx.containers.Panel;<br />
import mx.controls.Image;<br />
import mx.core.Application;<br />
import mx.effects.Move;<br />
import mx.effects.Parallel;<br />
import mx.effects.Resize;</p>
<p>//extendemos o nosso painel<br />
public class customPanel extends Panel<br />
{<br />
//incluimos as nossas imagens de maximizar, minimizar e restaurar<br />
//para a resposta do carregamento / troca das imagens seja imediata</p>
<p>[Embed(source="maxBut.png")]<br />
public var max:Class;</p>
<p>[Embed(source="minBut.png")]<br />
public var min:Class;</p>
<p>[Embed(source="restBut.png")]<br />
public var rest:Class;</p>
<p>//variaveis<br />
//estados do painel</p>
<p>private var maximizado:Boolean = false;<br />
private var minimizado:Boolean = false;</p>
<p>//imagens dos botões<br />
private var minBut:Image;<br />
private var maxBut:Image;</p>
<p>//usado para guardar os tamanhos e posições originais do nosso panel</p>
<p>private var originalSizeW:int;<br />
private var originalSizeH:int;<br />
private var originalPosX:int;<br />
private var originalPosY:int;</p>
<p>//construtor da nossa class<br />
public function customPanel()<br />
{<br />
//definimos alguns estilos do nosso panel para ficar mais agradável</p>
<p>this.setStyle(&#8220;headerHeight&#8221;,19);<br />
this.setStyle(&#8220;borderThicknessBottom&#8221;, 0);<br />
this.setStyle(&#8220;borderThicknessLeft&#8221;, 0);<br />
this.setStyle(&#8220;borderThicknessTop&#8221;, 0);<br />
this.setStyle(&#8220;borderThicknessRight&#8221;, 0);<br />
this.title=&#8221;Painel 1&#8243;;<br />
}</p>
<p>//re-escrevemos a função createChildren que o componente painel usa<br />
//para definir o novo layout que ele terá, ou seja vamos adicionar<br />
//os botões</p>
<p>override protected function createChildren():void {<br />
super.createChildren();</p>
<p>//guardamos as posições e tamanhos originais<br />
originalSizeW=this.unscaledHeight;<br />
originalSizeH=this.unscaledHeight;<br />
originalPosX=this.x;<br />
originalPosY=this.y;</p>
<p>/**<br />
Apenas vamos criar os botões se eles não existirem, temos<br />
que fazer isto porque esta função é chamada sempre que é<br />
adicionado um elemento novo ao painel, no caso de<br />
adicionarem uma caixa de texto esta função é chamada de novo<br />
e se não indicasse-mos o &#8220;if&#8221; ele iria criar novos botões<br />
sempre que fosse chamada.<br />
**/</p>
<p>//verificamos se o botão de minimizar existe<br />
if(!minBut){<br />
//criamos a nova imagem<br />
minBut=new Image;</p>
<p>//atribuimos a class (imagem) min ao nosso botão e definimos<br />
//alguns parametros<br />
minBut.source=min;<br />
minBut.visible=true;<br />
minBut.toolTip=&#8221;Minimiza&#8221;;</p>
<p>/**<br />
a imagem mostra o icon por defeito (seta), usamos os 3<br />
metodos em baixo para que o botão se comporte como um icon e<br />
apresente o cursor &#8220;hand&#8221; / mão.<br />
**/<br />
minBut.mouseChildren=false;<br />
minBut.useHandCursor=true;<br />
minBut.buttonMode=true;<br />
//Evento para detectar quando foi clicada.<br />
minBut.addEventListener(MouseEvent.CLICK, minOnClick, false, 0, true);</p>
<p>/**<br />
adicionamos como filho. Aqui adicionamos no metodo rawChildrem que faz<br />
um &#8220;overlay&#8221; à nossa imagem e vai apresenta-la em cima do painel, se<br />
usarmos apenas this.addChild() o nosso botão iria aparecer dentro da<br />
area util do painel e não no topo. Poderiamos usar também<br />
this.titleBar.addChild() onde a titlebar é o topo do nosso painel.**/</p>
<p>this.rawChildren.addChild(minBut);<br />
}</p>
<p>//o mesmo procedimento para a imagem de maximizar, notem que<br />
//não defini posições, elas serão definidas mais abaixo.<br />
if(!maxBut) {<br />
maxBut=new Image;<br />
maxBut.visible=true;<br />
maxBut.source=max;<br />
maxBut.toolTip=&#8221;Maximiza&#8221;;<br />
maxBut.mouseChildren=false;<br />
maxBut.useHandCursor=true;<br />
maxBut.buttonMode=true;<br />
maxBut.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);<br />
this.rawChildren.addChild(maxBut);<br />
}</p>
<p>//adicionamos um listner para saber quando o titleBar foi<br />
//clicado para iniciar o drag e drop</p>
<p>this .titleBar.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag,false,0,true);<br />
this .titleBar.addEventListener(MouseEvent.MOUSE_UP, endDrag,false,0,true);</p>
<p>// actualiza a displayList.<br />
invalidateDisplayList();<br />
}</p>
<p>/**<br />
Aqui vamos subscrever o metdo chamado pelo invalidateDisplayList()<br />
que vai ser chamado sempre que existam modificações a fazer no<br />
nosso layout, em cima como lhe adcionei duas imagens forcei a<br />
chamada da função em baixo para poder definir as posições dos meus<br />
botões.**/</p>
<p>protected  override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{</p>
<p>super.updateDisplayList(unscaledWidth, unscaledHeight);<br />
//definimos os tamanhos da nossa imagem<br />
//ela por defeito está com 16px por 16px mas vamos nos certificar<br />
//que elas ficam com esses tamanhos<br />
minBut.setActualSize(16,16);<br />
maxBut.setActualSize(16,16);</p>
<p>/**<br />
Vamos definir a posição x e y dos nossos botões<br />
o unscaledWidth indica-nos o tamanho &#8220;on-execution&#8221; do<br />
nosso painel, ou seja o tamanho actual, poderiamos usar o<br />
this.width, mas provocaria falhas no posicionamento visto<br />
que se o painel for aumentado esta actualização do<br />
this.height teria que aguardar pela actualização da<br />
displayList, ou seja, o tamanho final depois de maximizado<br />
apenas estaria disponivel no final da execução desta função.</p>
<p>Colocamos o botão de minimizar à direita do painel, mas<br />
deixamos um espaço em px para o botão de maximizar<br />
(-maxBut.width)**/</p>
<p>var xPos:Number = unscaledWidth &#8211; (minBut.width+maxBut.width);</p>
<p>// o botão ficará a 2px do topo<br />
var yPos:Number = 2;</p>
<p>//posicionamos o botão na devida posição<br />
minBut.move(xPos, yPos);</p>
<p>//usamos as mesmas variaveis em cima, mas agora para<br />
//posicionar o botão de maximizar</p>
<p>// como vai ficar à direita subtraimos apenas o seu tamanho ao<br />
//total do nosso painel<br />
xPos=unscaledWidth &#8211; maxBut.width;<br />
yPos=2;<br />
//subtraimos 4px para que o botão fiquem mais perto do<br />
//minimizar e mais afastado da lateral direita<br />
maxBut.move(xPos-4,yPos);<br />
}</p>
<p>// chamada para iniciar o drag do panel<br />
private function beginDrag(evt:MouseEvent):void {<br />
this.startDrag();<br />
}</p>
<p>// chamada para parar o drag do panel<br />
private function endDrag(evt:MouseEvent):void {<br />
this.stopDrag();</p>
<p>/**<br />
Ao parar temos que guardar a posição em que o painel foi<br />
largado para que ao restaurar o painel ir para a ultima<br />
posição onde foi deixado.<br />
**/<br />
originalPosX=this.x;<br />
originalPosY=this.y;<br />
}</p>
<p>//chamada quando o botão de minimizar é clicado.<br />
private function minOnClick(evt:MouseEvent):void {</p>
<p>/**<br />
Vamos inicializar alguns efeitos para executar na transição do<br />
nosso painel para o estado minimizado<br />
paralel, usado para exectuatr mais que um efeito ao mesmo tempo<br />
os efeitos executados por este paralel serão so seus child&#8217;s<br />
(efeitos)**/</p>
<p>var ambos:Parallel = new Parallel;</p>
<p>//efeito de mover<br />
var moveP:Move = new Move;</p>
<p>//efeito de dimensionar<br />
var dim:Resize = new Resize;</p>
<p>//definimos o target, a instancia, que será alvo do nossos efeitos<br />
//dentro do paralel<br />
ambos.target=this;</p>
<p>//movemos o painel para o x=0;<br />
moveP.xTo=0;<br />
// a nivel de y, movemos para o fundo da aplicação deixando apenas<br />
//19px de altura<br />
// que serão os mesmos 19px com que icará o painel de altura depois<br />
//de o efeito resize<br />
moveP.yTo=Application.application.height-19;</p>
<p>//efeito para dimensionar, alture=19, comprimento=150<br />
dim.heightTo=19;<br />
dim.widthTo=150;</p>
<p>//adiciona-mos o efeito de mover e dimensionar ao nosso paralel<br />
ambos.addChild(moveP);<br />
ambos.addChild(dim);<br />
//duração do efeito<br />
ambos.duration=250;<br />
//iniciamos o efeito<br />
ambos.play();</p>
<p>//usamos a variavel para indicar que o estado de minimizado está<br />
//activo<br />
minimizado=true;<br />
// como está minimizado o botão de maximizar para a ser substituido<br />
//pela imagem de restaurar<br />
maxBut.source=rest;<br />
//toolTip informativa<br />
maxBut.toolTip=&#8221;Restaura&#8221;;</p>
<p>}<br />
//Funcção chamado quando o botão de maximizar é clicado.<br />
private function onClick(evt:MouseEvent):void {<br />
//usamos as mesmas instancia de efeitos que no minimiza<br />
var ambos:Parallel = new Parallel;<br />
var dim:Resize = new Resize;<br />
var moveP:Move = new Move;</p>
<p>ambos.target=this;</p>
<p>/**<br />
O painel vai-se comportar da mesma maneira caso esteja<br />
minimizado ou maximizado<br />
já que a animação vai ser sempre a mesma = restaurar<br />
**/<br />
if(maximizado==true || minimizado==true ) {<br />
/**<br />
Definimos a altura e posição originais do nosso painel<br />
estas posições podem ser afectadas pelo drop, por isso sao<br />
automaticamente actualizadas.<br />
**/<br />
dim.heightTo=originalSizeH;<br />
dim.widthTo=originalSizeW;<br />
moveP.xTo=originalPosX;<br />
moveP.yTo=originalPosY;</p>
<p>//passa a estar no estado original<br />
maximizado=false;<br />
minimizado=false;<br />
//mudamos a imagem para maximizar<br />
maxBut.source=max;<br />
maxBut.toolTip=&#8221;Maximiza&#8221;;<br />
//duração do efeito<br />
ambos.duration=100;<br />
//adicionamos como filhos do nosso paralel<br />
ambos.addChild(dim);<br />
ambos.addChild(moveP);<br />
//iniciamos o efeito<br />
ambos.play();<br />
}<br />
else {<br />
/**usado para maximizar o painel caso o nosso painel esteja na<br />
posição original:<br />
altura em que o maximizado=false; e minimizado=false;<br />
definimos como tamanho a totalidade da area da nossa<br />
aplicação**/<br />
dim.heightTo=Application.application.height;<br />
dim.widthTo=Application.application.width;<br />
//movemos para a posição x=y=0<br />
moveP.xTo=0;<br />
moveP.yTo=0;<br />
//o seu estado passa a ser maximizado<br />
maximizado=true;<br />
maxBut.toolTip=&#8221;Restaura&#8221;;<br />
//mudamos para a imagem maximizada<br />
maxBut.source=rest;<br />
//duração do efeito<br />
ambos.duration=100;<br />
//childs<br />
ambos.addChild(dim);<br />
ambos.addChild(moveP);<br />
//play<br />
ambos.play();<br />
}<br />
}<br />
}<br />
}<br />
[/coolcode]</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Como podem ver, o processo é muito lógico e bem simples de executar, neste momento ao adicionares o vosso customPanel a uma aplicação, ele ficará exactamente igual a um painel normal do flex, mas a magia vem na hora da execução da vossa aplicação&#8230;querem ver? <a href="http://msdevstudio.com/blog/flexSource/testAS3Panel/" target="_blank">cliquem aqui</a> para ver o resultado final.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Para que este código funcione correctamente, necessitam de ter as 3 imagens correspondentes ao botão de maximizar, minimizar e restaurar, mas isso fica à vossa escolha, segue a dica do <a href="http://www.iconfinder.net/search/?q=iconset:sphericalcons" target="_blank">iconfinder </a>para um esquema de icons. Gravem com os nomes: restBut.png, maxBut.png,  minBut.png ou alterem o código para os vossos icons. Estes icons devem ser colocados na mesma pasta (com/msdevstudio) que o nosso customPanel.as (ficheiro em cima).</p>
<p>E pronto, têm um painel pronto a ser usado nas vossas aplicações que suporta Drag &amp; Drop, Maximizar, Minimizar e Restaurar&#8230; muito simples, pratico e eficiente.</p>
<p>Se conseguiram entender o processo posso afirmar que estão prontos para se aventurar de armas e bagagens pelo mundo do action script e suas classes.<br />
<strong> </strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">No Próximo tutorial iremos falar de filtros e efeitos&#8230;.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Duvidas? use o <a href="http://forum.msdevstudio.com" target="_blank">forum</a>.<strong> </strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;">Abraço.<strong> </strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-weight: inherit; font-style: inherit; font-size: 12px; font-family: inherit; vertical-align: baseline; text-align: justify; padding: 0px; border: 0px initial initial;"><em>p.s. O código não fica tabulado devido a uma falha da plugin, alguém conhece uma plugin alternativa para apresentar código as3?? No entanto segue a class <a href="http://msdevstudio.com/blog/wp-content/uploads/2010/01/customPanel.zip">customPanel</a> para download.</em><strong><br />
</strong></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;"><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="margin-bottom: 0cm; font-style: normal; font-weight: normal;" align="JUSTIFY"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #9900cc;"><strong>package</strong></span> com.msdevstudio</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">{</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//imports necessários ao nosso painel / class</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//Eventos</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> flash.events.Event;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> flash.events.MouseEvent;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> mx.containers.Panel;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> mx.controls.Image;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> mx.core.Application;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> mx.effects.Move;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> mx.effects.Parallel;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>import</strong></span><span style="color: #000000;"> mx.effects.Resize;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//extndemos o nosso painel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>public</strong></span><span style="color: #000000;"> </span><span style="color: #9900cc;"><strong>class</strong></span><span style="color: #000000;"> customPanel </span><span style="color: #0033ff;"><strong>extends</strong></span><span style="color: #000000;"> Panel</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//incluimos as nossas imagens de maximizar, minimizar e resturar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//para a resposta do carregamento / troca das imagens seja imediata</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> [</span><span style="color: #0033ff;"><strong>Embed</strong></span><span style="color: #000000;">(source=</span><span style="color: #990000;"><strong>"maxBut.png"</strong></span><span style="color: #000000;">)]</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>public</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> max:Class;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> [</span><span style="color: #0033ff;"><strong>Embed</strong></span><span style="color: #000000;">(source=</span><span style="color: #990000;"><strong>"minBut.png"</strong></span><span style="color: #000000;">)]</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>public</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> min:Class;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> [</span><span style="color: #0033ff;"><strong>Embed</strong></span><span style="color: #000000;">(source=</span><span style="color: #990000;"><strong>"restBut.png"</strong></span><span style="color: #000000;">)]</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>public</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> rest:Class;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//variaveis </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//estados do painel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> maximizado:Boolean = </span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> minimizado:Boolean = </span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//imagens dos botões</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> minBut:Image;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> maxBut:Image;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//usado para guardar os tamanhos e posições originais do nosso panel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> originalSizeW:int;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> originalSizeH:int;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> originalPosX:int;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> originalPosY:int;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//construtor da nossa class </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>public</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> customPanel()</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> { </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//definimos alguns estilos do nosso panel para ficar mais agradável</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #009900;"><em> </em></span><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.setStyle(</span><span style="color: #990000;"><strong>&#8220;headerHeight&#8221;</strong></span><span style="color: #000000;">,19);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.setStyle(</span><span style="color: #990000;"><strong>&#8220;borderThicknessBottom&#8221;</strong></span><span style="color: #000000;">, 0);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.setStyle(</span><span style="color: #990000;"><strong>&#8220;borderThicknessLeft&#8221;</strong></span><span style="color: #000000;">, 0);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.setStyle(</span><span style="color: #990000;"><strong>&#8220;borderThicknessTop&#8221;</strong></span><span style="color: #000000;">, 0);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.setStyle(</span><span style="color: #990000;"><strong>&#8220;borderThicknessRight&#8221;</strong></span><span style="color: #000000;">, 0);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.title=</span><span style="color: #990000;"><strong>&#8220;Painel 1&#8243;</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//re-escrevemos a função createChildren que o componente painel usa 		//para definir o novo layout que ele terá, ou seja vamos adicionar 		//os botões</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>override</strong></span><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>protected</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> createChildren():</span><span style="color: #0033ff;"><strong>void</strong></span><span style="color: #000000;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>super</strong></span><span style="color: #000000;">.createChildren();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//guardamos as posições e tamanhos originais</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> originalSizeW=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.unscaledHeight;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> originalSizeH=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.unscaledHeight;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> originalPosX=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.x;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> originalPosY=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.y;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//apenas vamos criar os botões se eles não existirem, temos 			//que fazer isto porque esta função é chamada sempre que é 				//adicionado um elemento novo ao painel, no caso de 					//adicionarem uma caixa de texto esta função é chamada de novo 			//e se não indicasse-mos o &#8220;if&#8221; ele iria criar novos botões 			//sempre que fosse chamada</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #009900;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><em> //verificamos se o botão de minimizar existe</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>if</strong></span><span style="color: #000000;">(!minBut){</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//criamos a nova imagem </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut=</span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Image;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//atribuimos a class (imagem) min ao nosso botão e definimos 			//alguns parametros</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> minBut.source=min;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut.visible=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut.toolTip=</span><span style="color: #990000;"><strong>&#8220;Minimiza&#8221;</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//a imagem mostra o icon por defeito (seta), usamos os 3 				//metodos em baixo para que o botão se comporte como um icon e 			//apresente o cursor &#8220;hand&#8221; / mão.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut.mouseChildren=</span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut.useHandCursor=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut.buttonMode=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//Evento para detectar quando foi clicada.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minBut.addEventListener(MouseEvent.CLICK, minOnClick, </span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">, 0, </span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//adicionamos como filho. Aqui adicionamos no metodo rawChildrem que faz 	//um &#8220;overlay&#8221; à nossa imagem e vai apresenta-la em cima do painel, se 	//usarmos apenas this.addChild() o nosso botão iria aparecer dentro da 	//area util do painel e não no topo. Poderiamos usar também 	//this.titleBar.addChild() onde a titlebar é o topo do nosso painel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.rawChildren.addChild(minBut); </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//o mesmo procedimento para a imagem de maximizar, notem que 			//não defini posições, elas serão definidas mais abaixo.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>if</strong></span><span style="color: #000000;">(!maxBut) {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut=</span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Image;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.visible=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> maxBut.source=max;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.toolTip=</span><span style="color: #990000;"><strong>&#8220;Maximiza&#8221;</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.mouseChildren=</span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.useHandCursor=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.buttonMode=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.addEventListener(MouseEvent.CLICK, onClick, </span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">, 0, </span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.rawChildren.addChild(maxBut); </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//adicionamos um listner para saber quando o titleBar foi 				//clicado para iniciar o drag e drop</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.titleBar.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag,</span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">,0,</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.titleBar.addEventListener(MouseEvent.MOUSE_UP, endDrag,</span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">,0,</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// actualiza a displayList.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> invalidateDisplayList();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//aqui vamos subscrever o metdo chamado pelo invalidateDisplayList() 		//que vai ser chamado sempre que existam modificações a fazer no 		// nosso layout, em cima como lhe adcionei duas imagens forcei a</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//chamada da função em baixo para poder definir as posições dos meus 		//botões.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #0033ff;"><strong>protected</strong></span><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>override</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):</span><span style="color: #0033ff;"><strong>void</strong></span><span style="color: #000000;">{</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>super</strong></span><span style="color: #000000;">.updateDisplayList(unscaledWidth, unscaledHeight);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//definimos os tamanhos da nossa imagem</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//ela por defeito está com 16px por 16px mas vamos certificar-			//nos que elas ficam com esses tamanhos</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> minBut.setActualSize(16,16);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> maxBut.setActualSize(16,16);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//vamos definir a posição x e y dos nossos botões</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// o unscaledWidth indica-nos o tamanho &#8220;on-execution&#8221; do 				//nosso painel, ou seja o tamanho actual, poderiamos usar o 			// this.width, mas provocaria falhas no posicionamento visto 			//que se o painel for aumentado esta actualização do 					//this.height teria que aguardar pela actualização da 				//displayList, ou seja, o tamanho final depois de maximizado 			//apenas estaria disponivel no final da execução desta função.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// colocamos o botão de minimizar à direita do painel, mas 				//deixamos um espaço em px para o botão de maximizar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #009900;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><em> // (-maxBut.width)</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> xPos:Number = unscaledWidth &#8211; (minBut.width+maxBut.width);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// o botão ficará a 2px do topo</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> yPos:Number = 2;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//posicionamos o botão na devida posição</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> minBut.move(xPos, yPos);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//usamos as mesmas variaveis em cima, mas agora para 					//posicionar o botão de maximizar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"><em> </em></span><span style="color: #009900;"><em>// como vai ficar à direita subtraimos apenas o seu tamanho ao 			//total do nosso painel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> xPos=unscaledWidth &#8211; maxBut.width;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> yPos=2;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//subtraimos 4px para que o botão fiquem mais perto do 				//minimizar e mais afastado da lateral direita </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> maxBut.move(xPos-4,yPos);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// chamada para iniciar o drag do panel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> beginDrag(evt:MouseEvent):</span><span style="color: #0033ff;"><strong>void</strong></span><span style="color: #000000;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.startDrag();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// chamada para parar o drag do panel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> endDrag(evt:MouseEvent):</span><span style="color: #0033ff;"><strong>void</strong></span><span style="color: #000000;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.stopDrag();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//ao parar temos que guardar a posição em que o painel foi 				//largado para que ao restaurar o painel ir para a ultima 				//posição onde foi deixado.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> originalPosX=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.x;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> originalPosY=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">.y;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//chamada quando o botão de minimizar é clicado.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> minOnClick(evt:MouseEvent):</span><span style="color: #0033ff;"><strong>void</strong></span><span style="color: #000000;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//vamos inicializar alguns efeitos para executar na transição do 		//nosso painel para o estado minimizado</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//paralel, usado para exectuatr mais que um efeito ao mesmo tempo</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//os efeitos executados por este paralel serão so seus child&#8217;s 			//(efeitos)</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> ambos:Parallel = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Parallel;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//efeito de mover</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> moveP:Move = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Move;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT">
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//efeito de dimensionar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> dim:Resize = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Resize;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//definimos o target, a instancia, que será alvo do nossos efeitos 		//dentro do paralel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> ambos.target=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//movemos o painel para o x=0; </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> moveP.xTo=0;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// a nivel de y, movemos para o fundo da aplicação deixando apenas 		//19px de altura</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// que serão os mesmos 19px com que icará o painel de altura depois 		//de o efeito resize</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> moveP.yTo=Application.application.height-19;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//efeito para dimensionar, alture=19, comprimento=150</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> dim.heightTo=19;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> dim.widthTo=150;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"><em> </em></span><span style="color: #009900;"><em>//adiciona-mos o efeito de mover e dimensionar ao nosso paralel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.addChild(moveP);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.addChild(dim);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//duração do efeito</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.duration=250;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//iniciamos o efeito</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.play();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//usamos a variavel para indicar que o estado de minimizado está 		//activo</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minimizado=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>// como está minimizado o botão de maximizar para a ser substituido 		//pela imagem de restaurar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> maxBut.source=rest;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//toolTip informativa</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.toolTip=</span><span style="color: #990000;"><strong>&#8220;Restaura&#8221;</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//Funcção chamado quando o botão de maximizar é clicado.</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>private</strong></span><span style="color: #000000;"> </span><span style="color: #339966;"><strong>function</strong></span><span style="color: #000000;"> onClick(evt:MouseEvent):</span><span style="color: #0033ff;"><strong>void</strong></span><span style="color: #000000;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//usamos as mesmas instancia de efeitos que no minimiza</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> ambos:Parallel = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Parallel;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> dim:Resize = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Resize;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> moveP:Move = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> Move;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> ambos.target=</span><span style="color: #0033ff;"><strong>this</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//O painel vai-se comportar da mesma maneira caso esteja 				//minimizado ou maximizado</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//já que a animação vai ser sempre a mesma = restaurar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>if</strong></span><span style="color: #000000;">(maximizado==</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;"> || minimizado==</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;"> ) {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//definimos a altura e posição originais do nosso painel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//estas posições podem ser afectadas pelo drop, por isso sao 			//automaticamente actualizadas</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> dim.heightTo=originalSizeH;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> dim.widthTo=originalSizeW;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> moveP.xTo=originalPosX;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> moveP.yTo=originalPosY;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//passa a estar no estado original</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maximizado=</span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> minimizado=</span><span style="color: #0033ff;"><strong>false</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//mudamos a imagem para maximizar</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> maxBut.source=max;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.toolTip=</span><span style="color: #990000;"><strong>&#8220;Maximiza&#8221;</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//duração do efeito</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.duration=100;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//adicionamos como filhos do nosso paralel</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.addChild(dim);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.addChild(moveP);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//iniciamos o efeito </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.play();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #0033ff;"><strong>else</strong></span><span style="color: #000000;"> {</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//usado para maximizar o painel caso o nosso painel esteja na 			//posição original:</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//altura em que o maximizado=false; e minimizado=false;</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//definimos como tamanho a totalidade da area da nossa 				//aplicação</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> dim.heightTo=Application.application.height;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> dim.widthTo=Application.application.width;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//movemos para a posição x=y=0</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> moveP.xTo=0;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> moveP.yTo=0;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//o seu estado passa a ser maximizado</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maximizado=</span><span style="color: #0033ff;"><strong>true</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> maxBut.toolTip=</span><span style="color: #990000;"><strong>&#8220;Restaura&#8221;</strong></span><span style="color: #000000;">;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//mudamos para a imagem maximizada</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> maxBut.source=rest;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//duração do efeito</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.duration=100;</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//childs</em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.addChild(dim);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.addChild(moveP);</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #000000;"> </span><span style="color: #009900;"><em>//play </em></span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> ambos.play();</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> } </span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"> }</span></span></span></p>
<p style="margin-bottom: 0cm;" align="LEFT"><span style="color: #000000;"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;">}</span></span></span></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.msdevstudio.net/2010/01/05/tutorial-action-script-3-015/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

