<?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>麟 - Alan Cheung &#187; Flex</title>
	<atom:link href="http://hkalan.com/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://hkalan.com</link>
	<description>Alan Cheung</description>
	<lastBuildDate>Wed, 28 Dec 2011 04:12:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Cannot run program &#8220;java.exe&#8221; &#8220;CreateProcess error=87, The parameter is incorrect&#8221;</title>
		<link>http://hkalan.com/2011/10/28/cannot-run-program-java-exe-createprocess-error87-the-parameter-is-incorrect/</link>
		<comments>http://hkalan.com/2011/10/28/cannot-run-program-java-exe-createprocess-error87-the-parameter-is-incorrect/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 01:41:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=455</guid>
		<description><![CDATA[Spent like a day to find out why flex would come up a java error, with a message like this: Cannot run program &#8220;java.exe&#8221; &#8220;CreateProcess error=87, The parameter is incorrect&#8221; However, compiling the source and run it off simulator would work fine. Things won&#8217;t work on the iPad / iPhone devices. Searching on google didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Spent like a day to find out why flex would come up a java error, with a message like this:</p>
<p>Cannot run program &#8220;java.exe&#8221; &#8220;CreateProcess error=87, The parameter is incorrect&#8221;</p>
<p>However, compiling the source and run it off simulator would work fine. Things won&#8217;t work on the iPad / iPhone devices.</p>
<p>Searching on google didn&#8217;t really help. Finally, found it is because the number of files included in the package is too much. In my case I have included 1200+ mp3 files from previous project. </p>
<p>Hope this will help someone to save time.</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2011/10/28/cannot-run-program-java-exe-createprocess-error87-the-parameter-is-incorrect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem in downloading file</title>
		<link>http://hkalan.com/2010/04/05/232/</link>
		<comments>http://hkalan.com/2010/04/05/232/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 11:57:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://hkalan.com/2010/04/05/232/</guid>
		<description><![CDATA[Click a button and download a file in Flex is very simple but Adobe’s official example has a problem which made me spent like 20 mins to find a work around. This won’t work: var request:URLRequest = new URLRequest&#40;&#34;index.xml&#34;&#41;; var fileRef:FileReference = new FileReference&#40;&#41;; fileRef.download&#40;request&#41;; But this will work: var fileRef:FileReference = new FileReference&#40;&#41;; function [...]]]></description>
			<content:encoded><![CDATA[<p>Click a button and download a file in Flex is very simple but Adobe’s official example has a problem which made me spent like 20 mins to find a work around.<br />
This won’t work:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;index.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> fileRef:FileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
fileRef.<span style="color: #006600;">download</span><span style="color: #66cc66;">&#40;</span>request<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>But this will work:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> fileRef:FileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> downloadFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>   
fileRef.<span style="color: #006600;">download</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;index.xml&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
downloadFile<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/04/05/232/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pass by Value</title>
		<link>http://hkalan.com/2010/04/05/pass-by-value/</link>
		<comments>http://hkalan.com/2010/04/05/pass-by-value/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 11:55:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=230</guid>
		<description><![CDATA[Actionscript 3 will always pass by reference unless the assignation is a primitive type (such as integer or string). I had an array and want to pass it by value (means it will copy the whole array’s value in it instead of referencing). It is because referencing will affect the referenced array when the new [...]]]></description>
			<content:encoded><![CDATA[<p>Actionscript 3 will always pass by reference unless the assignation is a primitive type (such as integer or string). I had an array and want to pass it by value (means it will copy the whole array’s value in it instead of referencing). It is because referencing will affect the referenced array when the new array is being changed in value.I came across with a script to deal with it. it may not be perfect, but have a look:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> clone<span style="color: #66cc66;">&#40;</span>source:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> myBA:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  myBA.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>source<span style="color: #66cc66;">&#41;</span>;
  myBA.<span style="color: #0066CC;">position</span> = <span style="color: #cc66cc;">0</span>;
  <span style="color: #b1b100;">return</span><span style="color: #66cc66;">&#40;</span>myBA.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Be aware that your objects in your array (or object)’s type may changed to Object/Array instead of it’s previous type.</p>
<p>UPDATE: There is also a method in Flex ObjectUtil class called &#8220;copy&#8221; <a href="http://livedocs.adobe.com/flex/201/langref/mx/utils/ObjectUtil.html#copy()">ObjectUtil.copy();</a> which copies the specified Object and returns a reference to the copy.</p>
<p>Hopefully this is helpful to someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/04/05/pass-by-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic itemrenderer reload when datachanged</title>
		<link>http://hkalan.com/2010/04/05/dynamic-itemrenderer-reload-when-data-changed/</link>
		<comments>http://hkalan.com/2010/04/05/dynamic-itemrenderer-reload-when-data-changed/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 11:47:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://hkalan.com/?p=225</guid>
		<description><![CDATA[I had some troubles to re-load my itemrenderer. When the dataprovider of your collection (Tilebase or whatever) chage, the itemrenderer of exists items does not re-init, if your code is in creationComplete event. Finally I found a solution:in your itemrenderer file, on the creationComplete handler, add: this.addEventListener&#40;FlexEvent.DATA_CHANGE, dataChanged&#41;;dataChanged&#40;&#41;; Then, in the dataChange function, you can [...]]]></description>
			<content:encoded><![CDATA[<p>I had some troubles to re-load my itemrenderer. When the dataprovider of your collection (Tilebase or whatever) chage, the itemrenderer of exists items does not re-init, if your code is in creationComplete event. Finally I found a solution:in your itemrenderer file, on the creationComplete handler, add:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>FlexEvent.<span style="color: #006600;">DATA_CHANGE</span>, dataChanged<span style="color: #66cc66;">&#41;</span>;dataChanged<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Then, in the dataChange function, you can do whatever you want for your itemrenderer when your dataprovider change.Hope this will help someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://hkalan.com/2010/04/05/dynamic-itemrenderer-reload-when-data-changed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

