<?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>ADM Blog &#187; Flex / ActionScript</title> <atom:link href="http://blog.another-d-mention.ro/category/programming/flex-actionscript/feed/" rel="self" type="application/rss+xml" /><link>http://blog.another-d-mention.ro</link> <description>No matter how you see things, reality changes when you reach understanding</description> <lastBuildDate>Fri, 22 Jul 2011 06:56:49 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1</generator> <item><title>FlashBuilder network issue</title><link>http://blog.another-d-mention.ro/programming/flashbuilder-network-issue/</link> <comments>http://blog.another-d-mention.ro/programming/flashbuilder-network-issue/#comments</comments> <pubDate>Fri, 21 May 2010 20:54:21 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[amfphp]]></category> <category><![CDATA[flash builder]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[monitor]]></category> <category><![CDATA[network]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=822</guid> <description><![CDATA[Like most of my articles here, I try to post solutions for unusual problems I encounter now and then that may help someone someday. And this one almost made me scream. So here's the story. My DEV environment (http://dev/) is a Virtual Host mapped in the Windows host file to point to a sandboxed directory [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li><li><a
href='http://blog.another-d-mention.ro/programming/neural-networks-in-actionscript-3/' rel='bookmark' title='Permanent Link: Neural networks in ActionScript 3'>Neural networks in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/' rel='bookmark' title='Permanent Link: How to identify at runtime if the swf is in debug or release mode/build'>How to identify at runtime if the swf is in debug or release mode/build</a></li></ol>]]></description> <content:encoded><![CDATA[<p><img
class="alignleft size-thumbnail wp-image-823" style="margin-right: 10px; margin-bottom: 10px;" title="ARGHHHHHHHHHHHH" src="http://cache.another-d-mention.ro/images/wp-content/uploads/2010/05/girl-scream-150x150.jpg" alt="girl scream 150x150 FlashBuilder network issue" width="150" height="150" />Like most of my articles here, I try to post solutions for unusual problems I encounter now and then that may help someone someday. And this one almost made me scream.</p><p>So here's the story. My DEV environment (http://dev/) is a Virtual Host mapped in the Windows host file to point to a sandboxed directory somewhere on my hard drive. The Flex project I'm building uses a RemoteObject and tries to communicate with a AMFPHP gateway to do it's stuff. All good till here.</p><p>The weird part is that when I try to run the app, even though my flash is coming from the DEV host and the path to the gateway points to the same DEV host, the AMF calls either failed with a security exception or if they worked, they were extremely slow. The delay between a service call and a response/error was somewhere between 6 and 10 seconds.</p><p>Why oh why !? The AMFPHP Browser app that comes with the package works just fine so my app was at fault somehow. Tried some investigations and thanks to Firebug I found the vital clue.</p><p>It seems that my app was trying to make the connection to the gateway through <strong>http://localhost:37813/</strong>. WTF ?? I didn't had any reference to 'localhost' in my code, yet the app was trying to connect using that address for some reason. And quite often, the crossdomain.xml failed to load resulting in a security error.</p><p>So what in the world is the problem then ? Well, Flash Builder seems to be the problem (and me for not RTFM).</p><p>It seems that if you compile your swf with<strong> Network Monitor</strong> active, which you may not realize, especially if the window is not even opened, you have just told your swf to redirect all traffic to localhost:37813. It will compile the redirect info into your flash. Traffic may work if you have Flash Builder debugger running but try to deploy that somewhere. Heh.</p><p>All you have to do is turn network monitor off. Recompile your swf. Redeploy.</p><p>Ta da !</p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li><li><a
href='http://blog.another-d-mention.ro/programming/neural-networks-in-actionscript-3/' rel='bookmark' title='Permanent Link: Neural networks in ActionScript 3'>Neural networks in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/' rel='bookmark' title='Permanent Link: How to identify at runtime if the swf is in debug or release mode/build'>How to identify at runtime if the swf is in debug or release mode/build</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/flashbuilder-network-issue/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Serialize JavaScript object to JSON</title><link>http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/</link> <comments>http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/#comments</comments> <pubDate>Wed, 28 Apr 2010 11:57:51 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Java Script]]></category> <category><![CDATA[deserialize]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[json]]></category> <category><![CDATA[object]]></category> <category><![CDATA[serialize]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=816</guid> <description><![CDATA[Recently, on a project I was working, I needed a function to serialize a JavaScript object and all I could find online were scripts and jquery plugins for serializing a html form. Then, I found this, a script that takes advantage of the .toSource() method available in Gecko-based browsers and for the rest of them [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/java-script/for-javascript-devs/' rel='bookmark' title='Permanent Link: For Javascript devs'>For Javascript devs</a></li><li><a
href='http://blog.another-d-mention.ro/programming/javascript-object-oriented-programming-oop-jclass/' rel='bookmark' title='Permanent Link: JavaScript Object-Oriented Programming (OOP) &#8211; jClass'>JavaScript Object-Oriented Programming (OOP) &#8211; jClass</a></li></ol>]]></description> <content:encoded><![CDATA[<p>Recently, on a project I was working, I needed a function to serialize a JavaScript object and all I could find online were scripts and jquery plugins for serializing a html form. Then, I found <a
href="http://blog.stchur.com/2007/04/06/serializing-objects-in-javascript/" target="_blank">this</a>, a script that takes advantage of the <i>.toSource()</i> method available in Gecko-based browsers and for the rest of them plain old recursion. But it does the trick as expected and I'm pretty sure someone else might need it.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td
class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> serialize<span style="color: #009900;">&#40;</span>_obj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_obj <span style="color: #339933;">!=</span> undefined <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">typeof</span> _obj.<span style="color: #660066;">toSource</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'undefined'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">typeof</span> _obj.<span style="color: #660066;">callee</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> _obj.<span style="color: #660066;">toSource</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #000066; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> _obj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'number'</span><span style="color: #339933;">:</span>
      <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'boolean'</span><span style="color: #339933;">:</span>
      <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'function'</span><span style="color: #339933;">:</span>
         <span style="color: #000066; font-weight: bold;">return</span> _obj<span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'string'</span><span style="color: #339933;">:</span>
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'&quot;'</span> <span style="color: #339933;">+</span> _obj.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/&quot;/mg</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;'</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'object'</span><span style="color: #339933;">:</span>
          <span style="color: #003366; font-weight: bold;">var</span> str<span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_obj.<span style="color: #660066;">constructor</span> <span style="color: #339933;">===</span> Array <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">typeof</span> _obj.<span style="color: #660066;">callee</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              str <span style="color: #339933;">=</span> <span style="color: #3366CC;">'['</span><span style="color: #339933;">;</span>
              <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span> len <span style="color: #339933;">=</span> _obj.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
              <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> len<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> str <span style="color: #339933;">+=</span> Utils.<span style="color: #660066;">serialize</span><span style="color: #009900;">&#40;</span>_obj<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">','</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
              str <span style="color: #339933;">+=</span> Utils.<span style="color: #660066;">serialize</span><span style="color: #009900;">&#40;</span>_obj<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']'</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
              str <span style="color: #339933;">=</span> <span style="color: #3366CC;">'{'</span><span style="color: #339933;">;</span>
              <span style="color: #003366; font-weight: bold;">var</span> key<span style="color: #339933;">;</span>
              <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>key <span style="color: #000066; font-weight: bold;">in</span> _obj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> str <span style="color: #339933;">+=</span> key <span style="color: #339933;">+</span> <span style="color: #3366CC;">':'</span> <span style="color: #339933;">+</span> Utils.<span style="color: #660066;">serialize</span><span style="color: #009900;">&#40;</span>_obj<span style="color: #009900;">&#91;</span>key<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">','</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
              str <span style="color: #339933;">=</span> str.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\,$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'}'</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
          <span style="color: #000066; font-weight: bold;">return</span> str<span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">default</span><span style="color: #339933;">:</span>
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'&quot;&quot;'</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p>To deserialize it, just use <i>eval()</i>.</p><p>Also, if you need the same thing for your Flash/Flex Actionscript3 project, here is a class for that as well -> <a
href="http://blog.another-d-mention.ro/stuff/Serializer.as" target="_blank">Click Me</a>.</p><p>Cheers! </pre><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/java-script/for-javascript-devs/' rel='bookmark' title='Permanent Link: For Javascript devs'>For Javascript devs</a></li><li><a
href='http://blog.another-d-mention.ro/programming/javascript-object-oriented-programming-oop-jclass/' rel='bookmark' title='Permanent Link: JavaScript Object-Oriented Programming (OOP) &#8211; jClass'>JavaScript Object-Oriented Programming (OOP) &#8211; jClass</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Neural networks in ActionScript 3</title><link>http://blog.another-d-mention.ro/programming/neural-networks-in-actionscript-3/</link> <comments>http://blog.another-d-mention.ro/programming/neural-networks-in-actionscript-3/#comments</comments> <pubDate>Thu, 11 Mar 2010 14:07:00 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[actionscript3]]></category> <category><![CDATA[ai]]></category> <category><![CDATA[artificial]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[intelligence]]></category> <category><![CDATA[networks]]></category> <category><![CDATA[neural]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=807</guid> <description><![CDATA["An artificial neural network (ANN), usually called "neural network" (NN), is a mathematical model or computational model that tries to simulate the structure and/or functional aspects of biological neural networks. It consists of an interconnected group of artificial neurons and processes information using a connectionist approach to computation. In most cases an ANN is an [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li></ol>]]></description> <content:encoded><![CDATA[<p><img
class="alignleft size-full wp-image-808" style="margin: 0px 10px 5px 0px;" title="Neural Network" src="http://cache.another-d-mention.ro/images/wp-content/uploads/2010/03/neural-network.gif" alt="neural network Neural networks in ActionScript 3" width="150" height="113" />"An <strong>artificial neural network (ANN)</strong>, usually called "neural  network" (NN), is a mathematical model or computational model that tries to  simulate the structure and/or functional aspects of biological neural  networks. It consists of an interconnected group of artificial neurons and processes information using a connectionist approach to computation. In most cases an ANN is an adaptive system that changes its structure based on external  or internal information that flows through the network during the  learning phase. Neural networks are non-linear statistical data  modeling tools. They can be used to model complex relationships  between inputs and outputs or to find patterns in data." (<a
href="http://en.wikipedia.org/wiki/Artificial_neural_network">Wikipedia</a>)</p><p><a
href="http://cache.another-d-mention.ro/images/wp-content/uploads/2010/03/mlp3.gif"><img
class="alignright size-full wp-image-809" title="Multi Layer Perceptron" src="http://cache.another-d-mention.ro/images/wp-content/uploads/2010/03/mlp3.gif" alt="mlp3 Neural networks in ActionScript 3" width="164" height="224" /></a>So, repetition is the mother of all learning they say. You damn right it is. And you can do it in AS3 of course. Not the fastest choice out there but that's not the point. NN's are usually not that fast but they're useful in so many ways.</p><p>So, here is my implementation of a neural network multi-layer-perceptron made in AS3, set to learn a simple XOR problem. It uses 2 inputs neurons , 2 hidden layers, each having 2 neurons and one output neuron. It takes about 2 seconds to train it using 10.000 epochs, but then you can save a snapshot of the NN memory as a byteArray, save it to the server and load it back again in an instant without requiring a new training.  I didn't take the time to thoroughly document the classes just yet but I'm sure you'll find them pretty easy to use.</p><p>Some reading material:<br
/> <a
href="http://en.wikipedia.org/wiki/Artificial_neural_network" target="_blank">http://en.wikipedia.org/wiki/Artificial_neural_network</a><br
/> <a
href="http://fbim.fh-regensburg.de/~saj39122/jfroehl/diplom/e-index.html" target="_blank">http://fbim.fh-regensburg.de/~saj39122/jfroehl/diplom/e-index.html</a> (this is great)<br
/> <a
href="http://www.ai-junkie.com/ann/evolved/nnt1.html" target="_blank">http://www.ai-junkie.com/ann/evolved/nnt1.html</a></p><div
align="center"> <object
id="nnet" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="397" height="411" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param
name="quality" value="high" /><param
name="bgcolor" value="#FFFFFF" /><param
name="allowScriptAccess" value="sameDomain" /><param
name="src" value="http://cache.another-d-mention.ro/stuff/nnet/NeuralNetworks.swf" /><param
name="name" value="SmartImage" /><param
name="align" value="middle" /><embed
id="nnet" type="application/x-shockwave-flash" width="397" height="411" src="http://cache.another-d-mention.ro/stuff/nnet/NeuralNetworks.swf" align="middle" name="SmartImage" allowscriptaccess="sameDomain" bgcolor="#FFFFFF" quality="high"></embed></object></div><p><a
href="http://cache.another-d-mention.ro/stuff/nnet/srcview/" target="_blank">Sources</a> and <a
href="http://cache.another-d-mention.ro/stuff/nnet/srcview/NeuralNetworks.zip" target="_blank">Download</a></p><p><script type="text/javascript">google_ad_client = "ca-pub-3771432957882119";
/* InsidePost */
google_ad_slot = "9112434755";
google_ad_width = 468;
google_ad_height = 60;</script><br
/> <script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/neural-networks-in-actionscript-3/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Create Flex/AS3 applications for Mobile Devices</title><link>http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/</link> <comments>http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/#comments</comments> <pubDate>Mon, 01 Feb 2010 14:17:00 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[android]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[elips]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[iphone]]></category> <category><![CDATA[mobile]]></category> <category><![CDATA[symbian]]></category> <category><![CDATA[windows]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=801</guid> <description><![CDATA[Yup! Flex Apps on your mobile. And I'm not talking about Flash Lite and you won't need CS5 either. ELIPS Studio converts the Flex code in native code for Windows Mobile, Symbian, Android, iPhone and mass-market mobiles. It's still beta and you have to register for a beta account to get it but I think [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/misc/flex-and-visual-studio/' rel='bookmark' title='Permanent Link: Flex and Visual Studio'>Flex and Visual Studio</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li></ol>]]></description> <content:encoded><![CDATA[<p><a
href="http://developer.openplug.com/" target="_blank"><img
class="alignleft size-thumbnail wp-image-802" title="elips-studio-3-box" src="http://cache.another-d-mention.ro/images/wp-content/uploads/2010/02/elips-studio-3-box-150x150.jpg" alt="elips studio 3 box 150x150 Create Flex/AS3 applications for Mobile Devices" width="150" height="150" /></a>Yup! Flex Apps on your mobile. And I'm not talking about <a
href="http://www.adobe.com/products/flashlite/" target="_blank">Flash Lite</a> and you won't need CS5 either.<br
/> <a
href="http://developer.openplug.com/" target="_blank">ELIPS Studio</a> converts the Flex code in native code for Windows Mobile, Symbian, Android, iPhone and mass-market mobiles. It's still beta and you have to register for a beta account to get it but I think will do wonders for the mobile dev. world.</p><p>And in their words:</p><p>"ELIPS Studio 3 is a plug-in for Adobe Flex Builder, a widely used IDE for internet &amp; desktop application. Our plug-in allows Flex to go mobile!</p><p>The product offers a mobile-optimized Flex Framework, plus numerous Flex extensions, including mobile UI components &amp; access to mobile device features (voice call, SMS, access to calendar and contacts, to the camera, etc.)</p><p>The product includes a form-factor device simulator allowing you to see your application behavior on different devices. It also includes a network simulator allowing to generate calls, SMS, etc."</p><p>So..get it while it's hot <img
src='http://blog.another-d-mention.ro/wp-includes/images/smilies/icon_smile.gif' alt="icon smile Create Flex/AS3 applications for Mobile Devices" class='wp-smiley' title="Create Flex/AS3 applications for Mobile Devices" /></p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/misc/flex-and-visual-studio/' rel='bookmark' title='Permanent Link: Flex and Visual Studio'>Flex and Visual Studio</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Adding ellipsis points in a TextArea component in Flex</title><link>http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/</link> <comments>http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/#comments</comments> <pubDate>Fri, 15 Jan 2010 14:55:12 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[ellipsis]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[points]]></category> <category><![CDATA[recursion]]></category> <category><![CDATA[textarea]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=779</guid> <description><![CDATA[The goal here is to use a TextArea component to display some text that doesn't quite fit in the specified region and ellipsis points (...) should be showed to let user know the text is trimmed. Standard stuff right ? But Flex doesn't do it by itself and I thought someone might look for this. [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/extendedimage-component/' rel='bookmark' title='Permanent Link: ExtendedImage Component'>ExtendedImage Component</a></li><li><a
href='http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/' rel='bookmark' title='Permanent Link: Serialize JavaScript object to JSON'>Serialize JavaScript object to JSON</a></li></ol>]]></description> <content:encoded><![CDATA[<p>The goal here is to use a TextArea component to display some text that doesn't quite fit in the specified region and ellipsis points (...) should be showed to let user know the text is trimmed. Standard stuff right ? But Flex doesn't do it by itself and I thought someone might look for this.</p><p>My problem was with a Flex app that uses i18n and in some languages the text didn't fit the box, the scroll bar policy was off and user had no idea there was more text in there and didn't had the possibility to scroll further. Anyway, here it is :</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td
class="code"><pre class="actionscript3" style="font-family:monospace;">	<span style="color: #000066; font-weight: bold;">&lt;</span>mx <span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000066; font-weight: bold;">!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
			<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000066; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000066; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000066; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span> <span style="color: #000066; font-weight: bold;">+</span>
						    <span style="color: #990000;">'The quick brown fox jumped over the lazy dog. '</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> trim<span style="color: #000000;">&#40;</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span>
			<span style="color: #000000;">&#123;</span>
				box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">;</span>
				box<span style="color: #000066; font-weight: bold;">.</span>validateNow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>box<span style="color: #000066; font-weight: bold;">.</span>maxVerticalScrollPosition <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #004993;">text</span> = <span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;...&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #004993;">text</span> = <span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">substr</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;...&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">text</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span> trim<span style="color: #000000;">&#40;</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx <span style="color: #000066; font-weight: bold;">:</span>TextArea id=<span style="color: #990000;">&quot;box&quot;</span>
		verticalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span>
		<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;250&quot;</span>
		<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;50&quot;</span>
		<span style="color: #004993;">wordWrap</span>=<span style="color: #990000;">&quot;true&quot;</span>
		<span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{trim(this.text)}&quot;</span>
		paddingBottom=<span style="color: #990000;">&quot;0&quot;</span>
		editable=<span style="color: #990000;">&quot;false&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span></pre></td></tr></table></div><p><img
src="http://cache.another-d-mention.ro/images/wp-content/uploads/2010/01/untitled.PNG" alt=" Adding ellipsis points in a TextArea component in Flex" title="Flex Output" width="278" height="74" class="aligncenter size-full wp-image-784" /></p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/extendedimage-component/' rel='bookmark' title='Permanent Link: ExtendedImage Component'>ExtendedImage Component</a></li><li><a
href='http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/' rel='bookmark' title='Permanent Link: Serialize JavaScript object to JSON'>Serialize JavaScript object to JSON</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>ExtendedImage Component</title><link>http://blog.another-d-mention.ro/programming/extendedimage-component/</link> <comments>http://blog.another-d-mention.ro/programming/extendedimage-component/#comments</comments> <pubDate>Thu, 12 Nov 2009 12:36:42 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[actionscript]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[component]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[library]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=753</guid> <description><![CDATA[I just finished writing a Flex3 library that will allow you to read a great number of image formats using flex and actionscript 3. The component uses a codec like rendering system, so each time you provide it with a source, the codecs attempt one by one to read the file signature and decide which [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/' rel='bookmark' title='Permanent Link: Adding ellipsis points in a TextArea component in Flex'>Adding ellipsis points in a TextArea component in Flex</a></li><li><a
href='http://blog.another-d-mention.ro/programming/read-load-files-from-zip-in-javascript/' rel='bookmark' title='Permanent Link: Read/Load files from ZIP in JavaScript'>Read/Load files from ZIP in JavaScript</a></li><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li></ol>]]></description> <content:encoded><![CDATA[<p>I just finished writing a Flex3 library that will allow you to read a great number of image formats using flex and actionscript 3. The component uses a codec like rendering system, so each time you provide it with a source, the codecs attempt one by one to read the file signature and decide which one is fit to decode the image.<br
/> So doing this, it won't matter the file extension or the way you provide the image asset (archived, link, base64 encoded, plain text, byteArray or embedded at compile time)</p><p>It's a work in progress but curently I've made codecs for the following formats:</p><ul><li>PointLineCAD 3D objects (*.p3d)</li><li>Photoshop images (*.psd, *.pdd)</li><li>ZSoft images (*.pcx)</li><li>Truevision TGA (*.tga, *. icb, *.vda, *.vst, *.win)</li><li>Windows icon files (*.ico)</li><li>GIF images (*.gif – static and animated gifs)</li><li>JPEG images (*.jpg. *.jpeg, *.gfif)</li><li>PNG (Portable network graphic) images (*.png)</li><li>Windows Bitmap images ( *.bmp, *.rle, *.dib)</li><li>Adobe Shockwave Flash (*.swf)</li></ul><p>As I said before, the way you provide the source doesn't really matter. You can zip up all your images in an archive and as source you can just point to the file inside the zip.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>adm :ExtendedImage id=<span style="color: #ff0000;">&quot;img&quot;</span> source=<span style="color: #ff0000;">&quot;archive.zip://image.png&quot;</span> <span style="color: #66cc66;">/&gt;</span></pre></td></tr></table></div><p>This way, you greatly reduce the number of requests to the server. But this is not all. Source can be also provided as a base64 encoded string, or as plain text (only p3d can take advantage of this since the p3d file is plain text as well).</p><p>For a bit more details, a <a
href="http://blog.another-d-mention.ro/downloads/extended-image/">demo</a> and API description, visit <a
href="http://blog.another-d-mention.ro/downloads/extended-image/">this page</a></p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/flex-actionscript/adding-ellipsis-points-in-a-textarea-component-in-flex/' rel='bookmark' title='Permanent Link: Adding ellipsis points in a TextArea component in Flex'>Adding ellipsis points in a TextArea component in Flex</a></li><li><a
href='http://blog.another-d-mention.ro/programming/read-load-files-from-zip-in-javascript/' rel='bookmark' title='Permanent Link: Read/Load files from ZIP in JavaScript'>Read/Load files from ZIP in JavaScript</a></li><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/extendedimage-component/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to identify at runtime if the swf is in debug or release mode/build</title><link>http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/</link> <comments>http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/#comments</comments> <pubDate>Tue, 07 Jul 2009 11:43:37 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[actionscript]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[debug]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[release]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=513</guid> <description><![CDATA[It may be interesting to know at runtime whether an application is running from a debug or release SWF file. It allows the application to automatically execute debug specific code when the file is a debug SWF file and ignore this code when it is published as a release file. Also, it should be nice [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/java-script/read-data-directly-from-base64-without-decoding/' rel='bookmark' title='Permanent Link: Read data directly from base64 without decoding'>Read data directly from base64 without decoding</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li></ol>]]></description> <content:encoded><![CDATA[<p>It may be interesting to know at runtime whether an application is running from a debug or release SWF file. It allows the application to automatically execute debug specific code when the file is a debug SWF file and ignore this code when it is published as a release file. Also, it should be nice to know if you have a debug flash player just for the same reasons. But for the last one, there is a function in the Capabilities class called isDebugger.</p><p>One solution would be to use <a
href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html" target="_blank">conditional compilation</a>. The other solution is in the following code (hack).</p><div
class="wp_syntax"><div
class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>adm<span style="color: #000066; font-weight: bold;">.</span>runtime
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.system</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Capabilities</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ModeCheck
	<span style="color: #000000;">&#123;</span>
		<span style="color: #3f5fbf;">/**
		 * Returns true if the user is running the app on a Debug Flash Player.
		 * Uses the Capabilities class
		 **/</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> isDebugPlayer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">Capabilities</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">isDebugger</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Returns true if the swf is built in debug mode
		 **/</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> isDebugBuild<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Error</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getStackTrace</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">search</span><span style="color: #000000;">&#40;</span><span style="color: #009966; font-style: italic;">/:[0-9]+]$/m</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Returns true if the swf is built in release mode
		 **/</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> isReleaseBuild<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">!</span>isDebugBuild<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div><p>This code simply searches for line numbers of errors in StackTrace result. Only StackTrace result of a debug SWF file contains line numbers. Then we know that we are running a debug or release SWF file.</p><p>This class is also available in the <a
href="http://blog.another-d-mention.ro/downloads/components-pack/">Components Pack</a> at Runtime subpackage</p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/' rel='bookmark' title='Permanent Link: How to clone (duplicate) an object in ActionScript 3'>How to clone (duplicate) an object in ActionScript 3</a></li><li><a
href='http://blog.another-d-mention.ro/programming/java-script/read-data-directly-from-base64-without-decoding/' rel='bookmark' title='Permanent Link: Read data directly from base64 without decoding'>Read data directly from base64 without decoding</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Ho-To: Install Alchemy</title><link>http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/</link> <comments>http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/#comments</comments> <pubDate>Wed, 24 Jun 2009 06:51:53 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[How To's]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[actionscript3]]></category> <category><![CDATA[alchemy]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[C#]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[library]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=493</guid> <description><![CDATA[For those of you who tried but didn't succed, I found some straigthforward instructions for this. Setup Hell: Install cygwin to "c:\cygwin" - make sure to check boxes to install Perl, "Archive" (ZIP), and Devel/gcc:g++ (3.4.4.3 presumably) (is Perl necessary?) Copy the alchemy directory to: c:\cygwin\home\Lee Copy the flex sdk bin dir from c:\program files\etc [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/misc/eee-pc/install-windows-xp-on-your-asus-eee-pc-using-a-usb-flash-drive/' rel='bookmark' title='Permanent Link: Install Windows XP on your Asus Eee PC using a USB flash drive'>Install Windows XP on your Asus Eee PC using a USB flash drive</a></li></ol>]]></description> <content:encoded><![CDATA[<p>For those of you who tried but didn't succed, I found some straigthforward instructions for this.</p><h4 class="vspace">Setup Hell:</h4><p>Install cygwin to "c:\cygwin" - make sure to check boxes to install Perl, "Archive" (ZIP), and Devel/gcc:g++ (3.4.4.3 presumably) (is Perl necessary?)<br
/> Copy the alchemy directory to: c:\cygwin\home\Lee<br
/> Copy the flex sdk bin dir from c:\program files\etc to "c:\flex" (to avoid paths with spaces in it!)<br
/> Run the alchemy config script once:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">   run cygwin
   <span style="color: #7a0874; font-weight: bold;">cd</span> alchemy
   .<span style="color: #000000; font-weight: bold;">/</span>config</pre></div></div><p>Edit the textfile "C:\cygwin\home\Lee\alchemy\alchemy-setup" and uncomment and edit line 22 to: add "export ADL=c:\flex\adl.exe"</p><p>Edit .bashrc (in C:\cygwin\home\Lee)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;LEE PROFILE&quot;</span>
   <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">FLEX_HOME</span>=~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">flex</span>
   <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">ALCHEMY_HOME</span>=~<span style="color: #000000; font-weight: bold;">/</span>alchemy
&nbsp;
   <span style="color: #666666; font-style: italic;"># &quot;This should be added before your PATH is modified&quot; !!</span>
   <span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>Lee<span style="color: #000000; font-weight: bold;">/</span>alchemy<span style="color: #000000; font-weight: bold;">/</span>alchemy-setup
&nbsp;
   <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$ALCHEMY_HOME</span><span style="color: #000000; font-weight: bold;">/</span>achacks:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>Lee<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">flex</span>:<span style="color: #007800;">$PATH</span>
   <span style="color: #7a0874; font-weight: bold;">export</span> PATH
&nbsp;
   alc-on</pre></div></div><p>Do this (just once, I think):</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$ALCHEMY_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin
   <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> llvm-stub llvm-stub.exe</pre></div></div><h4 class="vspace">Compiling a SW:</h4><p>CD to the directory with the source<br
/> Always do "alc-on" before compiling, cuz it doesn't work without it even though i added it to the startup (dunno)</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #c20cb9; font-weight: bold;">gcc</span> stringecho.c <span style="color: #660033;">-O3</span> <span style="color: #660033;">-Wall</span> <span style="color: #660033;">-swc</span> <span style="color: #660033;">-o</span> stringecho.swc
    <span style="color: #660033;">--</span> should give you a swc.</pre></div></div><p>Import the swc into your flex builder 4 project and make sure compiler targets SDK v4</p><h4 class="vspace">Shortcuts</h4><p><strong>alc-home</strong> - takes you to the Alchemy install folder.<br
/> <strong>alc-on</strong> - puts Alchemy gcc toolchain replacements at the front of your path.<br
/> <strong>alc-off</strong> - restores original path.<br
/> <strong>alc-util</strong> - shows you various Alchemy-related environment vars</p><p
class="vspace">USEFUL TO KNOW</p><p><strong>which gcc</strong> - tells you which gcc it will use (should be the one in the achacks dir)<br
/> <strong>ln</strong> - links shit<br
/> <strong>rm</strong> - deletes links as well as files</p><p
class="vspace">Ugh: Make sure to do "alc-on" and "alchemy-setup" even though you put it in the startup script <img
src='http://blog.another-d-mention.ro/wp-includes/images/smilies/icon_sad.gif' alt="icon sad Ho To: Install Alchemy" class='wp-smiley' title="Ho To: Install Alchemy" /> (?)</p><p
class="vspace">...</p><p>Objects:<br
/> <span
class="wikiword">AS3</span>_Val<br
/> <span
class="wikiword">AS3</span>_ArrayValue</p><p>Methods:<br
/> <span
class="wikiword">AS3</span>_Release<br
/> <span
class="wikiword">AS3</span>_LibInit</p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/flex-components-pack/' rel='bookmark' title='Permanent Link: Flex Components Pack'>Flex Components Pack</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/misc/eee-pc/install-windows-xp-on-your-asus-eee-pc-using-a-usb-flash-drive/' rel='bookmark' title='Permanent Link: Install Windows XP on your Asus Eee PC using a USB flash drive'>Install Windows XP on your Asus Eee PC using a USB flash drive</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Flex Components Pack</title><link>http://blog.another-d-mention.ro/programming/flex-components-pack/</link> <comments>http://blog.another-d-mention.ro/programming/flex-components-pack/#comments</comments> <pubDate>Tue, 09 Jun 2009 19:50:45 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[actionscript3]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[components]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[flex]]></category> <category><![CDATA[library]]></category> <category><![CDATA[swc]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=470</guid> <description><![CDATA[I've just started working on a set of Flex components which I call Flex Components Pack. I've only managed to make 11 components till now but I'm still working and have a lot of ideas on my to-do list. If any one of you is willing to help I would be very glad to get [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/' rel='bookmark' title='Permanent Link: Ho-To: Install Alchemy'>Ho-To: Install Alchemy</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li></ol>]]></description> <content:encoded><![CDATA[<p><img
class="alignright size-full wp-image-471" title="list" src="http://cache.another-d-mention.ro/images/wp-content/uploads/2009/06/list.png" alt="list Flex Components Pack" width="189" height="384" /> I've just started working on a set of Flex components which I call Flex Components Pack. I've only managed to make 11 components till now but I'm still working and have a lot of ideas on my to-do list. If any one of you is willing to help I would be very glad to get an extra brain in here. Just drop me a comment or something and I'll share the road-map and SVN path with you.</p><p>I've made a <a
href="http://blog.another-d-mention.ro/downloads/components-pack/">page</a> where I will add tutorials, code examples and runnable demos as soon as possible, so check back soon. Till then, you can <a
href="http://cache.another-d-mention.ro/stuff/ADMComponents.swc">download</a> the library and take a look.</p><p><strong>Update:</strong></p><p>(13/06/2009) - Added 5 more components. A simple but nice led light switch and 4 visualisation effects (EQTunnel, EQLine, EQWave, EQBars - winamp style). Just drag and drop the EQ on your app and it will animate any running sound inside your flash.</p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/create-professional-flex-components/' rel='bookmark' title='Permanent Link: Create professional Flex components'>Create professional Flex components</a></li><li><a
href='http://blog.another-d-mention.ro/programming/ho-to-install-alchemy/' rel='bookmark' title='Permanent Link: Ho-To: Install Alchemy'>Ho-To: Install Alchemy</a></li><li><a
href='http://blog.another-d-mention.ro/programming/create-flexas3-applications-for-mobile-devices/' rel='bookmark' title='Permanent Link: Create Flex/AS3 applications for Mobile Devices'>Create Flex/AS3 applications for Mobile Devices</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/flex-components-pack/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>How to clone (duplicate) an object in ActionScript 3</title><link>http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/</link> <comments>http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/#comments</comments> <pubDate>Fri, 05 Jun 2009 20:33:44 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Flex / ActionScript]]></category> <category><![CDATA[How To's]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[actionscript]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[clone]]></category> <category><![CDATA[flash]]></category> <category><![CDATA[flex]]></category> <guid
isPermaLink="false">http://blog.another-d-mention.ro/?p=440</guid> <description><![CDATA[For a project I needed to clone an object of unknown type. And by clone I mean to create a new instance of that same type and then fill out all its properties (including getters and setters) to mirror the original object. Thanks to a friend, I discovered the describeType function in AS3. But this alone [...]
Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/' rel='bookmark' title='Permanent Link: Serialize JavaScript object to JSON'>Serialize JavaScript object to JSON</a></li><li><a
href='http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/' rel='bookmark' title='Permanent Link: How to identify at runtime if the swf is in debug or release mode/build'>How to identify at runtime if the swf is in debug or release mode/build</a></li><li><a
href='http://blog.another-d-mention.ro/programming/javascript-object-oriented-programming-oop-jclass/' rel='bookmark' title='Permanent Link: JavaScript Object-Oriented Programming (OOP) &#8211; jClass'>JavaScript Object-Oriented Programming (OOP) &#8211; jClass</a></li></ol>]]></description> <content:encoded><![CDATA[<p>For a project I needed to clone an object of unknown type. And by clone I mean to create a new instance of that same type and then fill out all its properties (including getters and setters) to mirror the original object.</p><p>Thanks to a friend, I discovered the <a
href="http://livedocs.adobe.com/flex/2/langref/flash/utils/package.html#describeType%28%29">describeType </a>function in AS3. But this alone will only take care of the copying part. To create an object of the same type as another one we use <a
href="http://livedocs.adobe.com/flex/2/langref/flash/utils/package.html#getDefinitionByName%28%29">getDefinitionByName</a>.</p><p>Although Flash reflection is pretty basic, with a little work it will do the trick.</p><p>Get the <a
href="http://cache.another-d-mention.ro/stuff/cloneTest.zip">application files</a>.</p><p>Here's the code:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td
class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000066; font-weight: bold;">?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx <span style="color: #000066; font-weight: bold;">:</span>Application xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>local=<span style="color: #990000;">&quot;*&quot;</span> creationComplete=<span style="color: #990000;">&quot;init()&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">&gt;&lt;</span>mx <span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
 <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000066; font-weight: bold;">!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
&nbsp;
     <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>Alert<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
     <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">:</span>DataObject = <span style="color: #0033ff; font-weight: bold;">new</span> DataObject<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
     <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> cloneObject<span style="color: #000066; font-weight: bold;">:</span>DataObject<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
&nbsp;
     <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
&nbsp;
         <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span> = <span style="color: #990000;">'John Doe'</span><span style="color: #000066; font-weight: bold;">;</span>
         <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span>howMany = <span style="color: #000000; font-weight:bold;">4.5</span><span style="color: #000066; font-weight: bold;">;</span>
         <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span>when = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Date</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
         <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span>complexProp = <span style="color: #0033ff; font-weight: bold;">new</span> DataObject<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
         <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span>complexProp<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span> = <span style="color: #990000;">'Name in sub-object'</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
         cloneObject = UtilFunctions<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> DataObject<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
         Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Clone:<span style="">\n</span>name = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> cloneObject<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\n</span>howMany = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> cloneObject<span style="color: #000066; font-weight: bold;">.</span>howMany <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\n</span>when = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> cloneObject<span style="color: #000066; font-weight: bold;">.</span>when <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\n</span>complexProp.name = &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> cloneObject<span style="color: #000066; font-weight: bold;">.</span>complexProp<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
     <span style="color: #000000;">&#125;</span>
&nbsp;
     <span style="color: #3f5fbf;">/**
&nbsp;
      * describeType will produce this (for a DataObject instance):
      *
      * &lt;type name=&quot;DataObject&quot; base=&quot;Object&quot; isDynamic=&quot;false&quot; isFinal=&quot;false&quot; isStatic=&quot;false&quot;&gt;
&nbsp;
           &lt;extendsclass type=&quot;Object&quot;/&gt;
           &lt;accessor name=&quot;isHandicap&quot; access=&quot;writeonly&quot; type=&quot;Boolean&quot; declaredBy=&quot;DataObject&quot;/&gt;
&nbsp;
           &lt;variable name=&quot;howMany&quot; type=&quot;Number&quot;/&gt;
           &lt;accessor name=&quot;complexProp&quot; access=&quot;readwrite&quot; type=&quot;DataObject&quot; declaredBy=&quot;DataObject&quot;/&gt;
&nbsp;
           &lt;variable name=&quot;name&quot; type=&quot;String&quot;/&gt;
           &lt;variable name=&quot;when&quot; type=&quot;Date&quot;/&gt;
&nbsp;
&nbsp;
      *
      * */</span>
&nbsp;
 <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div><p>And the UtilFunctions.as file:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
</pre></td><td
class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">describeType</span><span style="color: #000066; font-weight: bold;">;</span>
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getDefinitionByName</span><span style="color: #000066; font-weight: bold;">;</span>
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getQualifiedClassName</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
 <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> UtilFunctions
 <span style="color: #000000;">&#123;</span>
&nbsp;
&nbsp;
     <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> newSibling<span style="color: #000000;">&#40;</span>sourceObj<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:*</span> <span style="color: #000000;">&#123;</span>
         <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>sourceObj<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
             <span style="color: #6699cc; font-weight: bold;">var</span> objSibling<span style="color: #000066; font-weight: bold;">:*;</span>
             <span style="color: #0033ff; font-weight: bold;">try</span> <span style="color: #000000;">&#123;</span>
                 <span style="color: #6699cc; font-weight: bold;">var</span> classOfSourceObj<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Class</span> = <span style="color: #004993;">getDefinitionByName</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">getQualifiedClassName</span><span style="color: #000000;">&#40;</span>sourceObj<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">Class</span><span style="color: #000066; font-weight: bold;">;</span>
                 objSibling = <span style="color: #0033ff; font-weight: bold;">new</span> classOfSourceObj<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
             <span style="color: #000000;">&#125;</span>
&nbsp;
             <span style="color: #0033ff; font-weight: bold;">catch</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>
&nbsp;
             <span style="color: #0033ff; font-weight: bold;">return</span> objSibling<span style="color: #000066; font-weight: bold;">;</span>
         <span style="color: #000000;">&#125;</span>
         <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
     <span style="color: #000000;">&#125;</span>
&nbsp;
     <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">clone</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span> <span style="color: #000000;">&#123;</span>
&nbsp;
         <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">clone</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000066; font-weight: bold;">;</span>
         <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #004993;">clone</span> = newSibling<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
             <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">clone</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                 copyData<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">clone</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
             <span style="color: #000000;">&#125;</span>
         <span style="color: #000000;">&#125;</span>
&nbsp;
         <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">clone</span><span style="color: #000066; font-weight: bold;">;</span>
     <span style="color: #000000;">&#125;</span>
&nbsp;
     <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> copyData<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000066; font-weight: bold;">,</span> destination<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
&nbsp;
         <span style="color: #009900; font-style: italic;">//copies data from commonly named properties and getter/setter pairs</span>
         <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000;">&#40;</span>destination<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
             <span style="color: #0033ff; font-weight: bold;">try</span> <span style="color: #000000;">&#123;</span>
                 <span style="color: #6699cc; font-weight: bold;">var</span> sourceInfo<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">XML</span> = <span style="color: #004993;">describeType</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                 <span style="color: #6699cc; font-weight: bold;">var</span> prop<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">XML</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                 <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span><span style="color: #000000;">&#40;</span>prop <span style="color: #0033ff; font-weight: bold;">in</span> sourceInfo<span style="color: #000066; font-weight: bold;">.</span>variable<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
                     <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>destination<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">hasOwnProperty</span><span style="color: #000000;">&#40;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                         destination<span style="color: #000000;">&#91;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span> = <span style="color: #004993;">source</span><span style="color: #000000;">&#91;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
                     <span style="color: #000000;">&#125;</span>
&nbsp;
                 <span style="color: #000000;">&#125;</span>
&nbsp;
                 <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span><span style="color: #000000;">&#40;</span>prop <span style="color: #0033ff; font-weight: bold;">in</span> sourceInfo<span style="color: #000066; font-weight: bold;">.</span>accessor<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                     <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@access == <span style="color: #990000;">&quot;readwrite&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                         <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>destination<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">hasOwnProperty</span><span style="color: #000000;">&#40;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                             destination<span style="color: #000000;">&#91;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span> = <span style="color: #004993;">source</span><span style="color: #000000;">&#91;</span>prop<span style="color: #000066; font-weight: bold;">.</span>@<span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
                         <span style="color: #000000;">&#125;</span>
&nbsp;
                     <span style="color: #000000;">&#125;</span>
                 <span style="color: #000000;">&#125;</span>
             <span style="color: #000000;">&#125;</span>
             <span style="color: #0033ff; font-weight: bold;">catch</span> <span style="color: #000000;">&#40;</span>err<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                 <span style="color: #000066; font-weight: bold;">;</span>
             <span style="color: #000000;">&#125;</span>
         <span style="color: #000000;">&#125;</span>
     <span style="color: #000000;">&#125;</span>
 <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div><p><a
class="FlattrButton" style="display:none;" href="http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/"></a><br
/> <noscript><a
href="http://flattr.com/thing/183337/How-to-clone-duplicate-an-object-in-ActionScript-3" target="_blank"><br
/> <img
src="http://api.flattr.com/button/flattr-badge-large.png" alt="flattr badge large How to clone (duplicate) an object in ActionScript 3" title="Flattr this" border="0" /></a></noscript></p><p><script type="text/javascript">google_ad_client = "ca-pub-3771432957882119";
/* InsidePost */
google_ad_slot = "9112434755";
google_ad_width = 468;
google_ad_height = 60;</script><br
/> <script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p><p>Related posts:<ol><li><a
href='http://blog.another-d-mention.ro/programming/flex-actionscript/serialize-javascript-object-to-json/' rel='bookmark' title='Permanent Link: Serialize JavaScript object to JSON'>Serialize JavaScript object to JSON</a></li><li><a
href='http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/' rel='bookmark' title='Permanent Link: How to identify at runtime if the swf is in debug or release mode/build'>How to identify at runtime if the swf is in debug or release mode/build</a></li><li><a
href='http://blog.another-d-mention.ro/programming/javascript-object-oriented-programming-oop-jclass/' rel='bookmark' title='Permanent Link: JavaScript Object-Oriented Programming (OOP) &#8211; jClass'>JavaScript Object-Oriented Programming (OOP) &#8211; jClass</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://blog.another-d-mention.ro/programming/how-to-clone-duplicate-an-object-in-actionscript-3/feed/</wfw:commentRss> <slash:comments>32</slash:comments> </item> </channel> </rss>
