<?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>Flex, Flash, Actionscript, Touchscreen, 3D and Culture</title>
	<atom:link href="http://uicomponent.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://uicomponent.com/blog</link>
	<description>FLEX is not enough!!</description>
	<lastBuildDate>Mon, 16 Jan 2012 11:16:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Debugging Parsley Problems</title>
		<link>http://uicomponent.com/blog/?p=329</link>
		<comments>http://uicomponent.com/blog/?p=329#comments</comments>
		<pubDate>Fri, 15 Apr 2011 11:14:35 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Parsley]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=329</guid>
		<description><![CDATA[Debugging with Parsley can sometimes prove to be a night mare, since it lacks any compile time support and can be flaky as objects are injected at multiple places. I was facing problem where the injections are not working and Init methods are not triggered, it took quite a while to figure out the actual [...]]]></description>
			<content:encoded><![CDATA[<p>Debugging with Parsley can sometimes prove to be a night mare, since it lacks any compile time support and can be flaky as objects are injected at multiple places. I was facing problem where the injections are not working and Init methods are not triggered, it took quite a while to figure out the actual problem. I had one class [AsyncInit] for the initialization logic, but unknowingly this tag was also there on a different class which I couldn't figure out soon. And this class is not firing the Event.COMPLETE which is causing the whole injection process to halt. So beware... it's Parsley..</p>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=329</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuration Properties in Parsley 2.3</title>
		<link>http://uicomponent.com/blog/?p=325</link>
		<comments>http://uicomponent.com/blog/?p=325#comments</comments>
		<pubDate>Wed, 23 Feb 2011 16:39:48 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=325</guid>
		<description><![CDATA[Now parsley 2.3 has the parser to load and understand an external config file. In general, most of the applications load a config.xml that has many configuration properties for the application on startup. I always thought this feature should always be in the framework and thanks to Parsley I reduced a few more lines of [...]]]></description>
			<content:encoded><![CDATA[<p>Now parsley 2.3 has the parser to load and understand an external config file. In general, most of the applications load a config.xml that has many configuration properties for the application on startup. I always thought this feature should always be in the framework and thanks to Parsley I reduced a few more lines of code. Adding a tag in the ContextBuilder loads the properties file. However, here we have to use .properties file instead of .xml file and I don't mind to use any of them. The syntax for adding a config.properties to load during runtime and startup is :</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;parsley:ContextBuilder</span> <span style="color: #000066;">config</span>=<span style="color: #ff0000;">&quot;{HelloWorldConfig}&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;parsley:PropertiesFile</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;data/config.properties&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/parsley:ContextBuilder<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>In this context, I have a config.properties file in the 'data' folder. The documentation explains about retrieving the values from the Parsley configuration object file directly by using properties.anyPropertyName, but just wondering if I want to access it from the application context??</p>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=325</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Content Assist&#8221; not working-Flash Builder</title>
		<link>http://uicomponent.com/blog/?p=318</link>
		<comments>http://uicomponent.com/blog/?p=318#comments</comments>
		<pubDate>Tue, 17 Aug 2010 09:16:55 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Flash Builder]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=318</guid>
		<description><![CDATA[Flash builder has suddenly failed to support the content assist feature while I was working on a project. I couldn't get it to working even if I restart my machine. After searching few solution, which are mostly for java-based eclipse, I found one that worked for Flash builder. It's simple, just close all the projects(not [...]]]></description>
			<content:encoded><![CDATA[<p>Flash builder has suddenly failed to support the content assist feature while I was working on a project. I couldn't get it to working even if I restart my machine. After searching few solution, which are mostly for java-based eclipse, I found one that worked for Flash builder. It's simple, just close all the projects(not 'clean') and restart the flash builder. Now when you open the project, content assist should have resumed operation. This should have fixed the problem, sorry if it hasn't. Basically, eclipse reloads the whole project when you open the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=318</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bold Font Embed &#8211; Actionscript 3</title>
		<link>http://uicomponent.com/blog/?p=310</link>
		<comments>http://uicomponent.com/blog/?p=310#comments</comments>
		<pubDate>Tue, 27 Apr 2010 09:04:34 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=310</guid>
		<description><![CDATA[Fonts are one of the most flaky things to work with in flash actionscript. However, the recent developments of actionscript 3 and flex has made it lot easier than it used to be actionscript 2. But, should always be cautious and careful when trying to use embed fonts. In flex, the embedding of fonts is [...]]]></description>
			<content:encoded><![CDATA[<p>Fonts are one of the most flaky things to work with in flash actionscript. However, the recent developments of actionscript 3 and flex has made it lot easier<br />
than it used to be actionscript 2. But, should always be cautious and careful when trying to use embed fonts. In flex, the embedding of fonts is easy, as you can specify in the CSS file. Following are examples for embedding fonts in flex and actionscript 3.</p>
<p>Flex:</p>
<pre>&nbsp;
 @font-face {
	src: url(&quot;fonts/GOTHICBI.TTF&quot;);
	font-family: GOTHICBI;
	font-weight: bold;
	font-style: italic;
	advancedAntiAliasing: true;
}
&nbsp;
@font-face {
	src: url(&quot;fonts/GOTHIC.TTF&quot;);
	font-family: GOTHIC;
	font-weight: normal;
	font-style: normal;
	advancedAntiAliasing: true;
}
&nbsp;</pre>
<p><b>Remember to specify font weight and font style.</b></p>
<p>In actionscript 3</p>
<pre>&nbsp;
[Embed(source=&quot;TT0005M_.TTF&quot;, fontFamily=&quot;Swiss 721 Bold BT&quot;, fontWeight=&quot;bold&quot;, mimeType=&quot;application/x-font-truetype&quot;)]
         static public var  Swiss721BoldBT:String;
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=310</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Line breaks in flex mxml/xml</title>
		<link>http://uicomponent.com/blog/?p=297</link>
		<comments>http://uicomponent.com/blog/?p=297#comments</comments>
		<pubDate>Tue, 23 Mar 2010 10:04:04 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex/Flash Tips and Tricks]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=297</guid>
		<description><![CDATA[This one problem every time I come across, thought if I would put the solution here, it will be a good reference to me and other developers as well. If \n or &#60;br&#62;, doesn't work for any reason, you can try using these html entities, &#38;#xD; or &#38;#13;]]></description>
			<content:encoded><![CDATA[<p>This one problem every time I come across, thought if I would put the solution here, it will be a good reference to me and other developers as well.<br />
If <b>\n</b> or <b>&lt;br&gt;</b>, doesn't work for any reason, you can try using these html entities, <b>&amp;#xD;</b> or <b>&amp;#13;</b></p>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=297</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could not create the view: Could not initialize class com.adobe.flexbuilder.util.logging.GlobalLog</title>
		<link>http://uicomponent.com/blog/?p=292</link>
		<comments>http://uicomponent.com/blog/?p=292#comments</comments>
		<pubDate>Tue, 23 Mar 2010 09:14:34 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex/Flash Tips and Tricks]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=292</guid>
		<description><![CDATA[Well, it's disappointing the first time I used the flash builder 4 after it's official release, I've got this error stating the views cannot be initialized. I've found the fix in the bug database, but is not clear as how to implement in this context. A "workaround" is to add an empty GlobalLog class with [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it's disappointing the first time I used the flash builder 4 after it's official release, I've got this error stating the views cannot be initialized. I've found the fix in the bug database, but is not clear as how to implement in this context.<br />
A "workaround" is to add an empty GlobalLog class with the right signature in the Eclipse classpath.<br />
You can do this by the following steps:</p>
<p>1) Download this file: <b><a href="http://bugs.adobe.com/jira/secure/attachment/54265/global-log-workaround.jar">http://bugs.adobe.com/jira/secure/attachment/54265/global-log-workaround.jar</a></b><br />
2) Copy the downloaded jar file to <b>C:\Program Files\Adobe\Adobe Flash Builder 4\plugins</b> directory, which is nothing but the 'plugins' directory of your flash builder 4 installation.<br />
3) Now open <b>FlashBuilder.ini</b> file in a notepad/text editor, from <b>C:\Program Files\Adobe\Adobe Flash Builder 4</b>, which is again your configuration directory in the flash builder  4 installation.<br />
4) Add this configuration variable, <b>*=file\:plugins/global-log-workaround.jar</b> in the end of the file.<br />
    Now your config.ini file should look similar to this:</p>
<p>-startup<br />
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar<br />
--launcher.library<br />
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519<br />
-nl<br />
en_US<br />
-vmargs<br />
-Xms256m<br />
-Xmx512m<br />
-XX:MaxPermSize=256m<br />
-XX:PermSize=64m<br />
-Djava.net.preferIPv4Stack=true<br />
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=dropins<br />
<b>-dev plugins/global-log-workaround.jar</b></p>
<p>5) Now restart your flex builder and unsurprisingly it should have been recovered.</p>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=292</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GradientFills &#8211; AS3</title>
		<link>http://uicomponent.com/blog/?p=285</link>
		<comments>http://uicomponent.com/blog/?p=285#comments</comments>
		<pubDate>Mon, 15 Mar 2010 20:18:04 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=285</guid>
		<description><![CDATA[Drawing gradient fills has been in flash from flash 8 version. It's so easy to draw the fills whether it's a Linear gradient fill or Radial gradient fill. Though, it's easy to draw the gradients, there's are few points to get your head around when trying to draw these type of fills, of which are [...]]]></description>
			<content:encoded><![CDATA[<p>Drawing gradient fills has been in flash from flash 8 version. It's so easy to draw the fills whether it's a Linear gradient fill or Radial gradient fill. Though, it's easy to draw the gradients, there's are few points to get your head around when trying to draw these type of fills, of which are 'ratios', 'spreadmethod' and 'focalpoint'.</p>
<p>This is the syntax of the gradient fill in AS3:</p>
<pre>&nbsp;
beginGradientFill(type:String, colors:Array, alphas:Array, ratios:Array, matrix:Matrix  = null, spreadMethod:String  = &quot;pad&quot;, interpolationMethod:String  = &quot;rgb&quot;, focalPointRatio:Number  = 0):void
&nbsp;</pre>
<p>ratios:Array - An array of ratio colors in the gradient. The values ranges from 0 to 255, for example, [0,100, 255], implies that at 0 the first color will be at its highest value(original color) similarly, at 100 and 255 the rest of the two colors will be at their highest values. So, you can see a gradient from 0 to 100 and 100 and 255.</p>
<p>focalPointRatio:Number - This is the value between -1 and 1, with 1 at the right hand side and -1 on the left side for the focal point when a radial gradient is drawn, and is horizontal. 0 is the default value. If you want to draw the focal point on the vertical axis, the trick is to use the 'rotation' property in the createGradientBox() and rotate it at an angle to acheive the desired direction.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_DrawingGradientFills_1548036997"
			class="flashmovie"
			width="550"
			height="300">
	<param name="movie" value="wp-content/uploads/2010/03/DrawingGradientFills.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="wp-content/uploads/2010/03/DrawingGradientFills.swf"
			name="fm_DrawingGradientFills_1548036997"
			width="550"
			height="300">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=285</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>1202: Access of undefined property UIDUtil</title>
		<link>http://uicomponent.com/blog/?p=278</link>
		<comments>http://uicomponent.com/blog/?p=278#comments</comments>
		<pubDate>Mon, 15 Mar 2010 14:43:34 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex/Flash Tips and Tricks]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=278</guid>
		<description><![CDATA[This is one of the errors I have stumbled upon today working on an older project. Everything was working fine until I have upgraded to flex builder 3.0.1. Usually, my flex builder doesn't recognize the 'graphics' property and BitmapData class, in auto completion. I lately realized that I am using flex builder 3.0.0 and haven't [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of the errors I have stumbled upon today working on an older project. Everything was working fine until I have upgraded to flex builder 3.0.1.<br />
Usually, my flex builder doesn't recognize the 'graphics' property and BitmapData class, in auto completion. I lately realized that I am using flex builder 3.0.0 and haven't<br />
upgraded to the next version. After upgrading, flex builder started to give this error and few other errors on binding events such as Watcher, PropertyChangeEvent etc.<br />
I've done all quick fixes which didn't work and couldn't get any help from web search as well. As I was messing around the problem, I've checked my flex build path and realized that it doesn't contain the framework.swc and rpc.swc files. After, adding these swc files from the sdks installation of flex(C:\Program Files\Adobe\Flex Builder 3\sdks\3.3.0\frameworks\libs) everything is kushti. Hope, this helps someone trying to fix this issue. </p>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=278</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brushup my Bitmap skills in AS3</title>
		<link>http://uicomponent.com/blog/?p=276</link>
		<comments>http://uicomponent.com/blog/?p=276#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:52:23 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=276</guid>
		<description><![CDATA[From today, I am going to brush-up my bitmap, animation and 3D skills in flash 9 actionscript 3.0. I started to read the books of Keith Peters and Todd yard, again. As, I continue to progress I will post some code and points so that it would be a reference to me in future. Hope, [...]]]></description>
			<content:encoded><![CDATA[<p>From today, I am going to brush-up my bitmap, animation and 3D skills in flash 9 actionscript 3.0. I started to read the books of Keith Peters and Todd yard, again. As, I continue to progress I will post some code and points so that it would be a reference to me in future. Hope, at least few things might be useful to other fellow developers, as well. First, I start with the curveTo() in AS3.</p>
<p>A bezier curve can be drawn using a cubic equation which has two control points that renders the curve. In flash, we can only draw quadratic beizer curves, where you can only specify one control point. The control points acts like a magnet that pulls the line towards itself.</p>
<pre>&nbsp;
  curveTo(controlPointX, controlPointY, anchorX, anchorY);
&nbsp;</pre>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_DrawingCurves_1960175891"
			class="flashmovie"
			width="300"
			height="350">
	<param name="movie" value="wp-content/uploads/2010/03/DrawingCurves.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="wp-content/uploads/2010/03/DrawingCurves.swf"
			name="fm_DrawingCurves_1960175891"
			width="300"
			height="350">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=276</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Local Connection 40K limit</title>
		<link>http://uicomponent.com/blog/?p=268</link>
		<comments>http://uicomponent.com/blog/?p=268#comments</comments>
		<pubDate>Wed, 10 Feb 2010 09:45:20 +0000</pubDate>
		<dc:creator>Kiran</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex/Flash Tips and Tricks]]></category>

		<guid isPermaLink="false">http://uicomponent.com/blog/?p=268</guid>
		<description><![CDATA[Yes, the maximum amount of data that can transferred through local connection from one swf to the other is 40 kilo bytes. Though, in most of the case scenario's you don't require to this amount of data to be transferred. However, when dealing with large objects such as data objects(VO), images etc. you would definitely [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, the maximum amount of data that can transferred through local connection from one swf to the other is 40 kilo bytes. Though, in most of the case scenario's you don't require to this amount of data to be transferred. However, when dealing with large objects such as data objects(VO), images etc. you would definitely stump on this problem. The solution is to chunk the large amount of datum to portions of less than 40K, say 38,900 bytes. I was working on building a custom debugger for flash, flex and AIR last week, and faced the same problem. So, I have created a method that will queue the request to send to the debugger and check if the objects are larger than 40K and chunk them. I'll present the core logic here to chunk the messages and queue them, however it's up to you to use it where required, and customize a bit.</p>
<pre class="actionscript">&nbsp;
package LCTest <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">kcode</span>.<span style="color: #006600;">flex</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">debug</span>.<span style="color: #006600;">MessagePacket</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">StatusEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #0066CC;">LocalConnection</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">registerClassAlias</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">utils</span>.<span style="color: #006600;">UIDUtil</span>;
	<span style="color: #808080; font-style: italic;">/**
	 *
	 * @author kiran.mannava
	 */</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LCTest <span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> active:<span style="color: #0066CC;">Boolean</span>;
		protected <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> instance:Debug;
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * connection string to talk to an AIR application is made up of
		 * app# + application id + . + publisher id + : + application id
		 * example: app#Slave.130A080AFCC69239D6F9896EEBED2327BC93ED43.1:Slave
		 * to use this sample, you must fill in your appropriate connection string below
		 */</span>
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const slaveLCConection:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;app#Slave.130A080AFCC69239D6F9896EEBED2327BC93ED43.1:Slave&quot;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> custom<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">message</span>:<span style="color: #0066CC;">String</span>, transferObject:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>active<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> mp:MessagePacket = <span style="color: #000000; font-weight: bold;">new</span> MessagePacket<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				mp.<span style="color: #0066CC;">data</span> = transferObject;
				mp.<span style="color: #0066CC;">message</span> = <span style="color: #0066CC;">message</span>;
				mp.<span style="color: #006600;">guid</span> = instance.<span style="color: #006600;">guid</span>;
				mp.<span style="color: #006600;">logLevel</span> = LogLevels.<span style="color: #006600;">CUSTOM</span>;
				instance.<span style="color: #006600;">messQueue</span>.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>mp<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getInstance<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:LCTest <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!instance<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				instance = <span style="color: #000000; font-weight: bold;">new</span> LCTest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> instance;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #808080; font-style: italic;">/**
		 * Initialize this object; establishes a connection with the slave and starts the half/full-duplex communication
		 * @param p_appName
		 *
		 */</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span>p_appName:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// create LocalConnection</span>
			getInstance<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			registerClassAlias<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;com.kcode.flex.utils.debug.MessagePacket&quot;</span>, com.<span style="color: #006600;">kcode</span>.<span style="color: #006600;">flex</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">debug</span>.<span style="color: #006600;">MessagePacket</span><span style="color: #66cc66;">&#41;</span>;
			instance.<span style="color: #006600;">guid</span> = UIDUtil.<span style="color: #006600;">createUID</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			instance.<span style="color: #006600;">primaryLC</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LocalConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			instance.<span style="color: #006600;">primaryLC</span>.<span style="color: #0066CC;">allowDomain</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'*'</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #808080; font-style: italic;">//primaryLC.client = this;</span>
			instance.<span style="color: #006600;">primaryLC</span>.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span>instance.<span style="color: #006600;">guid</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			instance.<span style="color: #006600;">lcToConsole</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LocalConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			instance.<span style="color: #006600;">lcToConsole</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>StatusEvent.<span style="color: #0066CC;">STATUS</span>, instance.<span style="color: #006600;">lcStatusChanged</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #808080; font-style: italic;">//</span>
			instance.<span style="color: #006600;">lcToConsole</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>slaveLCConection, <span style="color: #ff0000;">&quot;testSlave&quot;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #808080; font-style: italic;">// slaveLC is the remote app</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> lcToConsole:<span style="color: #0066CC;">LocalConnection</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LocalConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">// primaryLC is this application</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> primaryLC:<span style="color: #0066CC;">LocalConnection</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> isConnected:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #808080; font-style: italic;">// timer to ping LocalConnection</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> messQueue:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> packetFragmentSize:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">39200</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">// handle status changes, we keep checking the status of the slave,</span>
		<span style="color: #808080; font-style: italic;">//any message queued, will be sent directly or will testSlave</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> lcStatusChanged<span style="color: #66cc66;">&#40;</span>event:StatusEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//trace(event.level);</span>
&nbsp;
			<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">level</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;error&quot;</span>:
					connected = <span style="color: #000000; font-weight: bold;">false</span>;
					instance.<span style="color: #006600;">lcToConsole</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>slaveLCConection, <span style="color: #ff0000;">&quot;testSlave&quot;</span>, primaryLC.<span style="color: #0066CC;">domain</span> + <span style="color: #ff0000;">':Primary'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
					<span style="color: #b1b100;">break</span>;
&nbsp;
				<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;status&quot;</span>:
					connected = <span style="color: #000000; font-weight: bold;">true</span>;
					<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>instance.<span style="color: #006600;">messQueue</span>.<span style="color: #0066CC;">length</span> &gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
						instance.<span style="color: #006600;">sendMessageToConsole</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
						instance.<span style="color: #006600;">lcToConsole</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>slaveLCConection, <span style="color: #ff0000;">&quot;testSlave&quot;</span>, primaryLC.<span style="color: #0066CC;">domain</span> + <span style="color: #ff0000;">':Primary'</span><span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span>
&nbsp;
					<span style="color: #b1b100;">break</span>;
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/* Chop up a message into LocalConnection size packets */</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> makeMessagePackets<span style="color: #66cc66;">&#40;</span>p_orig:MessagePacket<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> ba:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			ba.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>p_orig<span style="color: #66cc66;">&#41;</span>;
			ba.<span style="color: #0066CC;">position</span> = <span style="color: #cc66cc;">0</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> packets:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> offset:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
			<span style="color: #808080; font-style: italic;">//For now left 800 Bytes availabe for packet wrapper data</span>
			<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">length</span>:<span style="color: #0066CC;">int</span>;
			<span style="color: #000000; font-weight: bold;">var</span> finalMessage:<span style="color: #0066CC;">Boolean</span>;
			<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>offset &lt; ba.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> packet:MessagePacket = <span style="color: #000000; font-weight: bold;">new</span> MessagePacket<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				packet.<span style="color: #006600;">guid</span> = p_orig.<span style="color: #006600;">guid</span>;
				packet.<span style="color: #006600;">isChunked</span> = <span style="color: #000000; font-weight: bold;">true</span>;
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>offset + packetFragmentSize &gt; ba.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #0066CC;">length</span> = ba.<span style="color: #0066CC;">length</span> - offset;
					packet.<span style="color: #006600;">finalMessage</span> = <span style="color: #000000; font-weight: bold;">true</span>;
				<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #0066CC;">length</span> = packetFragmentSize;
					packet.<span style="color: #006600;">finalMessage</span> = <span style="color: #000000; font-weight: bold;">false</span>;
				<span style="color: #66cc66;">&#125;</span>
				<span style="color: #000000; font-weight: bold;">var</span> dataFragment:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				dataFragment.<span style="color: #006600;">writeBytes</span><span style="color: #66cc66;">&#40;</span>ba, offset, <span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#41;</span>;
				dataFragment.<span style="color: #0066CC;">position</span> = <span style="color: #cc66cc;">0</span>;
				packet.<span style="color: #0066CC;">data</span> = dataFragment;
				instance.<span style="color: #006600;">messQueue</span>.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>packet<span style="color: #66cc66;">&#41;</span>;
				offset += packetFragmentSize;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// this is where the messages are send to the slave swf, the argument error implies that</span>
		<span style="color: #808080; font-style: italic;">// the message has exceeded the 40K limit, so should chunk into pieces..</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> sendMessageToConsole<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;sendMessageToConsole&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">try</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> mp:MessagePacket = instance.<span style="color: #006600;">messQueue</span>.<span style="color: #006600;">shift</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as MessagePacket;
				instance.<span style="color: #006600;">lcToConsole</span>.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>slaveLCConection, <span style="color: #ff0000;">&quot;traceOutput&quot;</span>, mp<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;MessagePacket -&gt; &quot;</span> + mp.<span style="color: #006600;">guid</span> + <span style="color: #ff0000;">&quot; - &quot;</span> + mp.<span style="color: #0066CC;">message</span> + <span style="color: #ff0000;">&quot; - &quot;</span> + mp.<span style="color: #006600;">isChunked</span> + <span style="color: #ff0000;">&quot; - &quot;</span> + mp.<span style="color: #006600;">finalMessage</span> + <span style="color: #ff0000;">&quot; - &quot;</span> + mp.<span style="color: #006600;">timeStamp</span> + <span style="color: #ff0000;">&quot; - &quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #66cc66;">&#125;</span> <span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span>aErr:ArgumentError<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>aErr.<span style="color: #0066CC;">message</span><span style="color: #66cc66;">&#41;</span>;
				instance.<span style="color: #006600;">makeMessagePackets</span><span style="color: #66cc66;">&#40;</span>mp<span style="color: #66cc66;">&#41;</span>;
				instance.<span style="color: #006600;">sendMessageToConsole</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #66cc66;">&#125;</span> <span style="color: #0066CC;">catch</span> <span style="color: #66cc66;">&#40;</span>err:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>err<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// receive LocalConnection response</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> invokeByDebug<span style="color: #66cc66;">&#40;</span>... <span style="color: #006600;">rest</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			connected = <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://uicomponent.com/blog/?feed=rss2&#038;p=268</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

