<?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>Filipe Silvestrim Blog &#187; Flex 3</title>
	<atom:link href="http://www.filipesilvestrim.com/blog/category/flex-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.filipesilvestrim.com/blog</link>
	<description>The life of a Game Developer</description>
	<lastBuildDate>Sat, 16 Apr 2011 08:54:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Clone a object with type cast</title>
		<link>http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/</link>
		<comments>http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 03:22:09 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/</guid>
		<description><![CDATA[<p>Wheel, I&#8217;m not writing another way of do it&#8230;</p> <p>Is the same way that ObjectUtils of Flex Framework do, but&#8230; Imagine that we want to duplicate one object of the class Example, we can just do the clone with a code like this:</p> public function deepClone ( obj : * ) : * { var [...]]]></description>
			<content:encoded><![CDATA[<p>Wheel, I&#8217;m not writing another way of do it&#8230;</p>
<p>Is the same way that ObjectUtils of Flex Framework do, but&#8230; Imagine that we want to duplicate one object of the class Example, we can just do the clone with a code like this:</p>
<pre class="brush: as3; title: ;">
public function deepClone ( obj : * ) : *
{
        var bytes : ByteArray = new ByteArray();
        bytes.writeObject(obj);
        bytes.position = 0;
        return bytes.readObject();
}
</pre>
<p>Let&#8217;s first imagine our Example class like this:</p>
<pre class="brush: as3; title: ;">
package com.filipesilvestrim
{
        public class Example
        {
                public var name : String;

                public function Example () {}
        }
}
</pre>
<p>Ok, but now if we try get the object with the cast like <strong>trace((deepClone(obj) as Example))</strong>. Man&#8230; shame on you, you&#8217;ll get &#8220;null&#8221;. but why? It occurs because when we are cloning the class we do it with the ByteArray and when you return that&#8217;s &#8220;new&#8221; bytes as an Object, the Flash Player don&#8217;t know that those bytes are affiliate with the class Example. So how to solve it?</p>
<p>Let&#8217;s register in the Flash Player the class Example, to that when it saw the bytes being cast, it understand that those bytes mean that class. To register we need to this:</p>
<pre class="brush: as3; title: ;">
registerClassAlias(&quot;com.filipesilvestrim.Example&quot;, Example);
</pre>
<p>And the code working will be like this:</p>
<pre class="brush: as3; title: ;">
package com.filipesilvestrim
{
        import flash.net.registerClassAlias;

        import com.filipesilvestrim.Example;

        public class MainClone
        {

                public function MainClone ()
                {
                        var obj : Example = new Example();

                        registerClassAlias(&quot;com.filipesilvestrim.Example&quot;, Example);

                        trace(&quot;Cloned Object with cast = &quot; + (deepClone(obj) as Example)); // must trace &quot;Cloned Object with cast = [object Example]&quot;

                }

                private function deepClone ( obj : * ) : *
                {
                        var bytes : ByteArray = new ByteArray();
                        bytes.writeObject(obj);
                        bytes.position = 0;
                        return bytes.readObject();
                }
        }
}
</pre>
<p>So, lets code and have fun <img src='http://www.filipesilvestrim.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Gravação &#8211; Usando Eclipse como ambiente de desenvolvimento com Flex3 SDK</title>
		<link>http://www.filipesilvestrim.com/blog/11/10/2007/gravacao-usando-eclipse-como-ambiente-de-desenvolvimento-com-flex3-sdk/</link>
		<comments>http://www.filipesilvestrim.com/blog/11/10/2007/gravacao-usando-eclipse-como-ambiente-de-desenvolvimento-com-flex3-sdk/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 14:58:18 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[Courses]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/11/10/2007/gravacao-usando-eclipse-como-ambiente-de-desenvolvimento-com-flex3-sdk/</guid>
		<description><![CDATA[<p>Pessoal,<br /> o Workshop de Outubro do <a href="http://www.augrs.com" target="_blank">AUGRS</a> já está disponível para visualização no link <a href="http://adobechats.adobe.acrobat.com/p77346236/">http://adobechats.adobe.acrobat.com/p77346236/</a></p> <p>Descrição do que fora abordado no Workshop mistrado pela Gabriela Perry:<br /> Nesta apresentação será mostrado como configurar o Eclipse para utilizá-lo como ambiente de criação para o Flex, utilizando o SDK.<br /> Para criação dos [...]]]></description>
			<content:encoded><![CDATA[<p>Pessoal,<br />
o Workshop de Outubro do <a href="http://www.augrs.com" target="_blank">AUGRS</a> já está disponível para visualização no link <a href="http://adobechats.adobe.acrobat.com/p77346236/">http://adobechats.adobe.acrobat.com/p77346236/</a></p>
<p>Descrição do que fora abordado no Workshop mistrado pela Gabriela Perry:<br />
Nesta apresentação será mostrado como configurar o Eclipse para utilizá-lo como ambiente de criação para o Flex, utilizando o SDK.<br />
Para criação dos arquivos será utilizado o ANT.<br />
Depois de configurar o Eclipse, será criado um arquvo mxml muito simples, apenas para ver como é o processo de criação.<br />
Na etapa seguinte, será mostrado como fazer debug utlizando o arquivo fdb.exe, que vem junto do SDK.<br />
Será utilizado o comando trace e a classe Log. No final, será mostrado como criar o arquivo flashlog.txt, que armazena os logs da sessão.</p>
<p>Quem estiver interessado, <a href="http://www.augrs.com/execultables/index.php?vfsPage=list" target="_blank">cadastre-se na lista de discussão</a> do <a href="http://" target="_blank">AUGRS</a> e fique atentos aos próximos workshops.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/11/10/2007/gravacao-usando-eclipse-como-ambiente-de-desenvolvimento-com-flex3-sdk/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

