<?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>Joris Timmerman</title>
	<atom:link href="http://www.joristimmerman.be/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joristimmerman.be/wordpress</link>
	<description>Multimedia Consultant @ BoulevArt</description>
	<lastBuildDate>Mon, 30 Aug 2010 08:26:47 +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>Google API &#8211; AS3 library: v. 2.0</title>
		<link>http://www.joristimmerman.be/wordpress/2009/04/15/google-api-as3-library-v-20/</link>
		<comments>http://www.joristimmerman.be/wordpress/2009/04/15/google-api-as3-library-v-20/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:29:44 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[suggest]]></category>
		<category><![CDATA[weather]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=304</guid>
		<description><![CDATA[General I&#8217;ve been busy at work, perhaps the reason why it was so silent on this blog. But I&#8217;m back! And one of my first act is to update the Google AS3 Library I&#8217;ve build a while ago. I started the library to support Google&#8217;s Ajax search API. Later on, when I found some new [...]]]></description>
			<content:encoded><![CDATA[<h3>General</h3>
<p>I&#8217;ve been busy at work, perhaps the reason why it was so silent on this blog.<br />
But I&#8217;m back! And one of my first act is to update the Google AS3 Library I&#8217;ve build a while ago.</p>
<p>I started the library to support Google&#8217;s Ajax search API.<br />
Later on, when I found some new webservices, I added those too. At the end, the entire library was one messy organically grown library.<br />
So I decided a while ago to clean that mess up.</p>
<h3>Changes &amp; new features</h3>
<ul>
<li>I reordened the package structure, meaning I devided the API in <em>ajaxapi</em> (<em>search</em>, <em>translation</em> and, the newly added, <strong><em>feeds</em></strong>), <strong><em>apicore</em></strong> (where you can store your api key), <em>suggest</em> (using the Google Suggest webservice) and <em>weather</em> (using the weather services).</li>
<li>I changed the name of the event GoogleSearchEvent to <strong>GoogleApiEvent</strong>, which is more relevant since the library is more than the Ajax search API.</li>
<li>Dito for the class that unites all features called GoogleSearch, it&#8217;s now called <strong>GoogleApi</strong></li>
<li>As already mentioned, I also added the ability to use an api key.</li>
</ul>
<p>I hope those changes make the library at least a bit more transparent and easier to get.</p>
<h3>Updating</h3>
<p>If you want to update the library your using, the easiest way is using FDT.</p>
<ol>
<li>Delete the old library and add the new one instead.</li>
<li>Right-click your source folder, goto Source and click &#8216;Organize imports&#8217;.</li>
<li>This will change your imports and correct them accordingly, so they point to the correct classes.</li>
<li>Correct the eventname, <em>GoogleSearchEvent</em> becomes <em>GoogleApiEvent. </em>You can do that by using a find &amp; replace, same for GoogleSearch to GoogleApi</li>
</ol>
<h3>Gimme, gimme , gimme</h3>
<p>The classes are still on Google Code, where a new version of the library has been committed into the SVN.<br />
The old classes have been moved to the branch folder. There is also a new update for GoogleEyes, containing the new libraries.</p>
<p>You can download those libraries <a href="http://googleas3api.googlecode.com/files/as3googleapilibs2.0.2.zip" onclick="pageTracker._trackPageview('/outgoing/googleas3api.googlecode.com/files/as3googleapilibs2.0.2.zip?referer=');">here</a>.<br />
GoogleEyes demo app can be found <a href="http://googleas3api.googlecode.com/files/GoogleEyes.air" onclick="pageTracker._trackPageview('/outgoing/googleas3api.googlecode.com/files/GoogleEyes.air?referer=');">here</a>.</p>
<p>The project is hosted on Google Code <a href="http://code.google.com/p/googleas3api" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/googleas3api?referer=');">(see)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2009/04/15/google-api-as3-library-v-20/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Multi-Mania 2009 (2M&#8217;09) announced!</title>
		<link>http://www.joristimmerman.be/wordpress/2009/03/13/2m09-announced/</link>
		<comments>http://www.joristimmerman.be/wordpress/2009/03/13/2m09-announced/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 13:30:49 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AS3]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=264</guid>
		<description><![CDATA[Today Koen De Weggheleire announced Multi-Mania &#8217;09, my personal favourite multimedia conference and still stands for Europe’s Biggest Free Multimedia FEST! Multi-Mania is going to be a two day free conference in KORTRIJK XPO, BELGIUM offering workshops and 4 tracks full of national and international speakers … kind of unique in Europe …especially because the conference doesn’t [...]]]></description>
			<content:encoded><![CDATA[<p>Today <a title=" Koen De Weggheleire" href="http://www.newmovieclip.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.newmovieclip.com/?referer=');">Koen De Weggheleire</a> announced Multi-Mania &#8217;09, my personal favourite multimedia conference and still stands for Europe’s Biggest Free Multimedia FEST!</p>
<p><strong><span>Multi</span>-<span>Mania</span></strong> is going to be a<strong> two day free conference</strong> in <a title="KORTRIJK XPO ROCKS !!" href="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Kortrijk+XPO,+Doorniksesteenweg+216,+8500+Kortrijk,+belgium&amp;sll=37.0625,-95.677068&amp;sspn=51.222969,114.257812&amp;ie=UTF8&amp;ll=50.811623,3.279011&amp;spn=0.010074,0.027895&amp;z=16" target="_blank" onclick="pageTracker._trackPageview('/outgoing/maps.google.com/maps?f=q_amp_source=s_q_amp_hl=en_amp_geocode=_amp_q=Kortrijk+XPO_+Doorniksesteenweg+216_+8500+Kortrijk_+belgium_amp_sll=37.0625_-95.677068_amp_sspn=51.222969_114.257812_amp_ie=UTF8_amp_ll=50.811623_3.279011_amp_spn=0.010074_0.027895_amp_z=16&amp;referer=');"><strong>KORTRIJK XPO, BELGIUM</strong></a> offering <strong>workshops and 4 tracks full of national and international speakers</strong> … kind of unique in Europe …especially because the conference doesn’t cost anything for the attendees. They want all the multimedia folks to <strong>learn something</strong>, <strong>be inspired</strong> and <strong>get connected</strong> !</p>
<div class="wp-caption alignnone" style="width: 560px"><a class="iframe" id="fancy" href="http://www.multi-mania.be" onclick="pageTracker._trackPageview('/outgoing/www.multi-mania.be?referer=');"><img title="Multi-Mania 09" src="http://newmovieclip.files.wordpress.com/2009/03/multi_mania_09.jpg" alt="Multi-Mania 09" width="550" /></a><p class="wp-caption-text">Multi-Mania 09</p></div>
<p>The  first day of the event (May 18th) will be <strong>one day full of workshops</strong> where you will be able to learn a lot from the experts. The second day (May 19th) will be the full conference like you know &#8216;em from the last 9 years!<br />
That means that they are expecting <strong>more then 30 spreakers from around the world</strong> who have something cool and interesting to say about <strong>DESIGN, DEVELOPMENT, MOBILE,  VIDEO/AUDIO and 3D DESIGN/DEVELOPMENT</strong>.</p>
<p>Of course <strong>the one and only awardshow in the evening</strong> will be there, where the best <strong>multimedia student projects will win cool prices</strong> and afterwards we can celebrate at the <strong>2M09 PARTY</strong> !! If you, as a company, want to meet the upcoming talents, <strong>the awardshow is “tha place to be”</strong> !</p>
<p>Last year they had <strong>more then 1000 peoples</strong> attending the event and this year they even have space for even more attendees.<br />
<strong>Registration for the event is FREE and will open at April 20</strong>, so mark that date in your agenda!</p>
<p>Speakers will be announced very soon so make sure to check the <a title="MULTI-MANIA 09" href="http://www.multi-mania.be/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.multi-mania.be/?referer=');"><strong>http://www.multi-mania.be</strong></a> website as much as you can in the upcoming days… weeks…</p>
<p>If you are interested in sponsoring the event or if you have something cool to talk about, do not hesitate to contact Koen De Weggheleire at <strong>info@newmovieclip.com</strong>.</p>
<p>I am looking forward to it and I hope you also do …. <strong>2M09 WILL ROCK !!!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2009/03/13/2m09-announced/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ScreenManager: expand your AIR application (to multiple monitors)</title>
		<link>http://www.joristimmerman.be/wordpress/2009/03/03/screenmanager-expand-your-air-application/</link>
		<comments>http://www.joristimmerman.be/wordpress/2009/03/03/screenmanager-expand-your-air-application/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 17:13:55 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[multi-screen]]></category>
		<category><![CDATA[multiscreen]]></category>
		<category><![CDATA[screenmanager]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=250</guid>
		<description><![CDATA[Never wondered how cool it would be when your AIR application runs on 2 or more monitors at the same time? Adobe AIR supports multi-screen by offering the developer a Screen-class. This class makes it possible to detect screens, get some info, and that&#8217;s it. To open a window on a screen, you&#8217;ll have to [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="font-weight: normal; font-size: 13px;">Never wondered how cool it would be when your AIR application runs on 2 or more monitors at the same time?</span></h1>
<p>Adobe AIR supports multi-screen by offering the developer a Screen-class.<br />
This class makes it possible to detect screens, get some info, and that&#8217;s it.<br />
To open a window on a screen, you&#8217;ll have to do some calculations yourself.</p>
<p>To make positioning screens, moving screens, &#8230; easier , I quickly build a ScreenManager that takes care of your NativeWindow(s).<br />
Make an instance of the nativewindow and send it throught the manager.<br />
Like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> nw:NativeWindow=<span style="color: #000000; font-weight: bold;">new</span> NativeWindow<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NativeWindowInitOptions<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
nw.<span style="color: #0066CC;">width</span>=<span style="color: #cc66cc;">250</span>
nw.<span style="color: #0066CC;">height</span>=<span style="color: #cc66cc;">90</span>
<span style="color: #000000; font-weight: bold;">var</span> mc:<span style="color: #0066CC;">MovieClip</span>=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//movieclip with content</span>
nw.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>mc<span style="color: #66cc66;">&#41;</span>;
ScreenManager.<span style="color: #006600;">openWindowCenteredOnScreen</span><span style="color: #66cc66;">&#40;</span>nw,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The ScreenManager is a static class.<br />
It allow the developer to control a NativeWindow through the following methods:<br />
<em> (incorrect signatures)</em></p>
<ul>
<li>ScreenManager.centerWindowOnScreen()</li>
<li>ScreenManager.getActualScreenBounds()</li>
<li>ScreenManager.getScreenColorDepth()</li>
<li>ScreenManager.getVisibleScreenBounds()</li>
<li>ScreenManager.moveWindow()</li>
<li>ScreenManager.openWindowCenteredOnScreen()</li>
<li>ScreenManager.openWindowOnScreen()</li>
<li>ScreenManager.stretchWindowToAllScreens()</li>
<li>ScreenManager.stretchWindowOnScreen()</li>
<li>ScreenManager.openWindowFullScreenOn()</li>
<li>ScreenManager.setWindowFullScreenOn()</li>
<li>ScreenManager.moveWindowToCorner()</li>
<li>ScreenManager.openWindowInCorner()</li>
</ul>
<p>and the following properties:</p>
<ul>
<li>ScreenManager.mainScreenIndex</li>
<li>ScreenManager.numScreens</li>
<li>ScreenManager.maximumAvailableResolution</li>
</ul>
<p>The ScreenManager can be <a href="http://airscreenmanageras3.googlecode.com/files/AIRScreenManager.zip" onclick="pageTracker._trackPageview('/outgoing/airscreenmanageras3.googlecode.com/files/AIRScreenManager.zip?referer=');"> downloaded here </a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2009/03/03/screenmanager-expand-your-air-application/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Pseudo Threading in Actionscript 3 (for Flash &amp; Flex)</title>
		<link>http://www.joristimmerman.be/wordpress/2009/01/11/pseudo-threading-in-actionscrip-as3/</link>
		<comments>http://www.joristimmerman.be/wordpress/2009/01/11/pseudo-threading-in-actionscrip-as3/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 17:51:25 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Things not there]]></category>
		<category><![CDATA[Workarounds]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=149</guid>
		<description><![CDATA[About threads In any desktop programming language like C#, Java or even VB, a developer has the ability of performing certain tasks in seperate threads, building a multi-threading application. A thread is a part of a process that functions independently and seperatly and can only interact through system-provided inter-process communication mechanisms. This increases the performance [...]]]></description>
			<content:encoded><![CDATA[<h2>About threads</h2>
<p>In any desktop programming language like C#, Java or even VB, a developer has the ability of performing certain tasks in seperate threads, building a multi-threading application.<br />
A thread is a part of a process that functions independently and seperatly and can only interact through system-provided inter-process communication mechanisms.<br />
This increases the performance of the application and saves the CPU from any high-duty work.<br />
In Actionscript however, there is no custom threading, no threads at all, meaning Actionscript is single-threaded.<br />
That also means unfortunatly, when doing some heavy computation, the UI  of your application cannot be updated while you&#8217;re doing that heavy computation, so your application appears stuck or effects don&#8217;t run smoothly.</p>
<p>When I was developing the FLVRecorder classes, I encountered this problem, cursing Satan. Converting the saved bitmaps was so intense that the application froze.<br />
A Thread class like in Java, could come in real handy on moments like that, but there is none.<br />
When I was doing some r&amp;d on how to split up code, simulating threads, I found a PseudoThread class by Alex Harui that could simulate a thread in the application on the Adobe Blogs (link: <a href="http://blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html" onclick="pageTracker._trackPageview('/outgoing/blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html?referer=');">here)</a>.</p>
<p>This pseudo-threading works well, it does enhance perfomance a bit, and the most important, the application only slowed down &amp; did not freeze when saving.<br />
But there is a problem with this class, it only works with Flex, because it is using a Flex specific class, called SystemManager (from the mx.managers package).</p>
<h2>Using threads in Flash</h2>
<p>We are going to convert this PseudoThread class so we can use it in a Flash application and to use this class in Flash, we need to replace the SystemManager class with something else without losing the performance enhancements.</p>
<p>After trying some combinations, I came up with this very good solution.</p>
<h3>Here is how I did it&#8230;</h3>
<p>The class that I found on the Adobe Blogs, uses a UIComponent added to the systemManager to run the code on in a enterframe. I replaced this UIComponent by a Sprite, and the systemManager by the stage.</p>
<p>First, I  changed the constructor of the PT class by replacing the systemManager variable with an instance of the stage.<br />
Then I added a global variable <em>sm, </em>from type Sprite and initialized this variable in the constructor and added it to the stage instance that is passed on in the constructors parameters.<br />
I did some changing on the event listeners, by setting the weakreference parameter on true (adding &#8216;,false, 0, true&#8217; after defining eventhandling function), allowing the FP to destroy the event listeners easier.</p>
<h3>How it looks like</h3>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package be.<span style="color: #006600;">boulevart</span>.<span style="color: #006600;">threading</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">Stage</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">EventDispatcher</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">KeyboardEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #0066CC;">getTimer</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PseudoThread <span style="color: #0066CC;">extends</span> EventDispatcher <span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// number of milliseconds we think it takes to render the screen</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> RENDER_DEDUCTION : <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">20</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> fn : <span style="color: #000000; font-weight: bold;">Function</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> obj : <span style="color: #0066CC;">Object</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> thread : Sprite;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">start</span> : <span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> due : <span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> sm : Sprite
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> mouseEvent : <span style="color: #0066CC;">Boolean</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> keyEvent : <span style="color: #0066CC;">Boolean</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> PseudoThread<span style="color: #66cc66;">&#40;</span>yourStage : <span style="color: #0066CC;">Stage</span>,threadFunction : <span style="color: #000000; font-weight: bold;">Function</span>,threadObject : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			fn = threadFunction;
&nbsp;
			sm = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
			yourStage.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>sm<span style="color: #66cc66;">&#41;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				obj = threadObject;
			<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
				obj = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">// add high priority listener for ENTER_FRAME</span>
			sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span> , enterFrameHandler , <span style="color: #000000; font-weight: bold;">false</span> , <span style="color: #cc66cc;">200</span> , <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span> , mouseMoveHandler , <span style="color: #000000; font-weight: bold;">false</span> , <span style="color: #cc66cc;">0</span> , <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span> , keyDownHandler , <span style="color: #000000; font-weight: bold;">false</span> , <span style="color: #cc66cc;">0</span> , <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			thread = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			sm.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>thread<span style="color: #66cc66;">&#41;</span>;
			thread.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">RENDER</span> , renderHandler<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event : Event<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">start</span> = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> fr : <span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1000</span> <span style="color: #66cc66;">/</span> thread.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">frameRate</span><span style="color: #66cc66;">&#41;</span>;
			due = <span style="color: #0066CC;">start</span> + fr;
&nbsp;
			thread.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">invalidate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			thread.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			thread.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span> , <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
			thread.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span> , <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> renderHandler<span style="color: #66cc66;">&#40;</span>event : Event<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>mouseEvent <span style="color: #66cc66;">||</span> keyEvent<span style="color: #66cc66;">&#41;</span>
			 due -= RENDER_DEDUCTION;
&nbsp;
			<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>lt; due<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>fn<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
						<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>thread.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#41;</span>
						<span style="color: #b1b100;">return</span>;
&nbsp;
						sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span> , enterFrameHandler<span style="color: #66cc66;">&#41;</span>;
						sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span> , mouseMoveHandler<span style="color: #66cc66;">&#41;</span>;
						sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span> , keyDownHandler<span style="color: #66cc66;">&#41;</span>;
						sm.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>thread<span style="color: #66cc66;">&#41;</span>;
						thread.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">RENDER</span> , renderHandler<span style="color: #66cc66;">&#41;</span>;
&nbsp;
						thread = <span style="color: #000000; font-weight: bold;">null</span>
						thread = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
						dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;threadComplete&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span>
				<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>fn<span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
						<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>thread.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#41;</span>
						<span style="color: #b1b100;">return</span>;
&nbsp;
						sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span> , enterFrameHandler<span style="color: #66cc66;">&#41;</span>;
						sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_MOVE</span> , mouseMoveHandler<span style="color: #66cc66;">&#41;</span>;
						sm.<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span> , keyDownHandler<span style="color: #66cc66;">&#41;</span>;
						sm.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>thread<span style="color: #66cc66;">&#41;</span>;
&nbsp;
						thread = <span style="color: #000000; font-weight: bold;">null</span>
						thread = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
						thread.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">RENDER</span> , renderHandler<span style="color: #66cc66;">&#41;</span>;
						dispatchEvent<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;threadComplete&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span>
				<span style="color: #66cc66;">&#125;</span>
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			mouseEvent = <span style="color: #000000; font-weight: bold;">false</span>;
			keyEvent = <span style="color: #000000; font-weight: bold;">false</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> mouseMoveHandler<span style="color: #66cc66;">&#40;</span>event : Event<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			mouseEvent = <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyDownHandler<span style="color: #66cc66;">&#40;</span>event : Event<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			keyEvent = <span style="color: #000000; font-weight: bold;">true</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This class works in Flash (FP9) &amp; Flex.</p>
<h2>Conclusion</h2>
<p>Pseudo threading is a bit painfull, it&#8217;s not the real deal and it&#8217;s slow, but it&#8217;s the best we have right now.<br />
This can make the difference between a slow app or a smoothly running one.<br />
One day, if Adobe is feeling like it, threading will be build in, since more and more RIA builders long for it and since the competition is getting tougher (Sliverlight has build in threading for example).</p>
<h2>Download</h2>
<p>Download the <a href="http://www.joristimmerman.be/wordpress/wp-content/uploads/pseudothreading.zip">PseudoThread class</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2009/01/11/pseudo-threading-in-actionscrip-as3/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Extending BulkLoader &#8211; Throwing an event when an item is downloaded</title>
		<link>http://www.joristimmerman.be/wordpress/2009/01/08/extending-bulkloader-onitemdownload/</link>
		<comments>http://www.joristimmerman.be/wordpress/2009/01/08/extending-bulkloader-onitemdownload/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 11:30:05 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[bulkloader]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[as3 bulk-loader on item download]]></category>
		<category><![CDATA[on item download]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=132</guid>
		<description><![CDATA[A while ago, I needed something that could load a LOT of images at a short times notice without Flash crashing or stopping in the middle of the queue without reason, like what happens if you loop a Loader 500 times. Then I found BulkLoader&#8230; It was all I needed, but then the client wanted [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I needed something that could load a LOT of images at a short times notice without Flash crashing or stopping in the middle of the queue without reason, like what happens if you loop a Loader 500 times.</p>
<p>Then I found BulkLoader&#8230;<br />
It was all I needed, but then the client wanted the image added to the stage at the moment it was downloaded, this is not build in the  BulkLoaders classes, so I extended those.</p>
<p>Here is how I did it.</p>
<h2>Getting started</h2>
<p>We are going to extend the BulkLoader classes so it throws an event when a single download has finished.<br />
To do this, get the latest version of BulkLoader at <a title="Google Code" href="http://code.google.com/p/BulkLoader/" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/BulkLoader/?referer=');">Google Code</a>.</p>
<p>Unpack the zipped file, and open up the BulkLoader.as and BulkProgressEvent.as in the br.com.stimuli.loading package.</p>
<h2>BulkLoader.as</h2>
<p>Let&#8217;s start with adding an event constant name with the global variables:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const ITEMLOADED : <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;item_loaded&quot;</span>;</pre></div></div>

<p>You may insert it under the line (178):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const COMPLETE : <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;complete&quot;</span>;</pre></div></div>

<p>Next scroll down to the function _onItemComplete (line 801).<br />
At the bottom of that function you should see the following if-statement:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>allDone<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    _onAllLoaded<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>replace it with:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> eItemL : BulkProgressEvent = <span style="color: #000000; font-weight: bold;">new</span> BulkProgressEvent<span style="color: #66cc66;">&#40;</span>ITEMLOADED,item<span style="color: #66cc66;">&#41;</span>;
eItemL.<span style="color: #006600;">setInfo</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">bytesLoaded</span>, <span style="color: #0066CC;">bytesTotal</span>, bytesTotalCurrent, _itemsLoaded, itemsTotal, weightPercent<span style="color: #66cc66;">&#41;</span>;
dispatchEvent<span style="color: #66cc66;">&#40;</span>eItemL<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>allDone<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      _onAllLoaded<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
 <span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>What did we do here?<br />
We&#8217;re creating an instance of  a  BulkProgressEvent and add relevant information to it.<br />
Next we&#8217;re going to dispatch it everytime this function is called.<br />
As you can see, we&#8217;ve given the constructor another new parameter, the loaded item, we wil have to extend the BulkProgressEvent.</p>
<h2>BulkProgressEvent.as</h2>
<p>Start with adding a constant, a new name for a new kind of Event, an ITEMLOADED event, you can do that under line 52:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const ITEMLOADED : <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;item_loaded&quot;</span>;</pre></div></div>

<p>Next, create an new public variable (or an private one and make it a property by adding  a getter &amp; a setter), named lastLoadedItem (under line 70 for example):</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;">var</span> lastLoadedItem:LoadingItem;</pre></div></div>

<p>Now we are going to change the BulkProgressEvents constructor by adding a new parameter. Insert llItem:LoadingItem=null after the name parameter so the constructor looks like this:</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> BulkProgressEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">name</span> : <span style="color: #0066CC;">String</span>,llItem:LoadingItem=<span style="color: #000000; font-weight: bold;">null</span>, bubbles:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span>, cancelable:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">false</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></pre></div></div>

<p>We gave it the default value <em>null</em> so we don&#8217;t have to change other code from the rest of the project.</p>
<p>Don&#8217;t forget to import LoadingItem</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> br.<span style="color: #006600;">com</span>.<span style="color: #006600;">stimuli</span>.<span style="color: #006600;">loading</span>.<span style="color: #006600;">loadingtypes</span>.<span style="color: #006600;">LoadingItem</span>;</pre></div></div>

<p>In the constructor, under the line</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">name</span> = <span style="color: #0066CC;">name</span>;</pre></div></div>

<p>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;">lastLoadedItem</span> = llItem;</pre></div></div>

<p>Change in the clone function the line:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> b : BulkProgressEvent = <span style="color: #000000; font-weight: bold;">new</span> BulkProgressEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>, bubbles, cancelable<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> b : BulkProgressEvent = <span style="color: #000000; font-weight: bold;">new</span> BulkProgressEvent<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>, lastLoadedItem, bubbles, cancelable<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>And you&#8217;re done!<br />
Now you can add an new eventlistener to you BulkLoader instance and capture every new loaded item.</p>
<h2>Usage</h2>
<p><span id="more-132"></span><br />
Just add another listener to the BulkLoader instance to listen for the ITEMLOADED event.<br />
You can retrieve your last loaded item in the function you assigned to that ITEMLOADED event by calling that public variable/property lastLoadedItem.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> loader: BulkLoader = <span style="color: #000000; font-weight: bold;">new</span> BulkLoader<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;galleryLoader&quot;</span><span style="color: #66cc66;">&#41;</span>
loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>BulkLoader.<span style="color: #006600;">COMPLETE</span>,bloaderComplete<span style="color: #66cc66;">&#41;</span>
loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>BulkLoader. <span style="color: #006600;">ITEMLOADED</span>, itemComplete<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> itemComplete<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:BulkProgressEvent<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;lastLoadedItem:&quot;</span> + <span style="color: #0066CC;">e</span>.<span style="color: #006600;">lastLoadedItem</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h2>Download</h2>
<p>Here is a download, adjusted version of BulkLoader r239: <a href="http://www.joristimmerman.be/wordpress/wp-content/uploads/bulkloader_r239.zip">download</a>.</p>
<h2>What is BulkLoader?</h2>
<p>BulkLoader is a minimal library written in Actionscript 3 (AS3) that aims to make loading and managing complex loading requirements easier and faster. BulkLoader takes a more dynamic, less architecture heavy aproach. Few imports and making heavy use of AS3&#8242;s dynamic capabilities, BulkLoader has a one-liner feel that doesn&#8217;t get in your way.</p>
<p>BulkLoader tries to hide the complexity of loading different data types in AS3 and provides a unified interface for loading, accessing and events notification for different types of content.</p>
<p>This library is licensed under an open source MIT license. Features:</p>
<ul>
<li>Connection pooling.</li>
<li>Unified interface for different loading types.</li>
<li>Unified progress notification.</li>
<li>Events for individual items and as groups.</li>
<li>Priority</li>
<li>Stop and resuming individually as well as in bulk.</li>
<li>Cache management.</li>
<li>Statistics about loading (latency, speed, average speed).</li>
<li>Various kinds on progress indication: ratio (items loaded / items to load), bytes , and weighted percentage.</li>
<li>Configurable number of retries.</li>
<li>Configurable logging.</li>
<li>Various assest types (XML, NetStreams, Swfs, Images, Sound, Text Files)</li>
</ul>
<p>Design goals:</p>
<ul>
<li>Minimal imports.</li>
<li>Few method to learn.</li>
<li>Consistent interface, regardless of content type.</li>
</ul>
<p>BulkLoader tries to gracefully handle progress notification in these use cases:</p>
<ul>
<li>Few connections to open: bytes total can be used instantly.</li>
<li>Many connections opened: progress by ratio</li>
<li>Many connections opened for data of widely varying sizes: progress by weight.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2009/01/08/extending-bulkloader-onitemdownload/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Happy New Year!</title>
		<link>http://www.joristimmerman.be/wordpress/2009/01/02/happy-new-year/</link>
		<comments>http://www.joristimmerman.be/wordpress/2009/01/02/happy-new-year/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 10:45:52 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=94</guid>
		<description><![CDATA[I wish you all a very happy and prosperous new year, 2009, with a minimum on bugs and a maximum on coding fun. Wish you a good health, a lot of fun, touching, moving moments! That your wishes all come true this year! Hoping to see some cool new projects the coming year, with a lot [...]]]></description>
			<content:encoded><![CDATA[<h1><a href="http://www.joristimmerman.be/wordpress/wp-content/uploads/2009-print-preview-blog.png"><img class="alignright size-thumbnail wp-image-113" title="2009-print-preview-blog" src="http://www.joristimmerman.be/wordpress/wp-content/uploads/2009-print-preview-blog-150x150.png" alt="2009-print-preview-blog" height="200" /></a></h1>
<p>I wish you all a very happy and prosperous new year, 2009, with a minimum on bugs and a maximum on coding fun.<br />
Wish you a good health, a lot of fun, touching, moving moments! That your wishes all come true this year!<br />
Hoping to see some cool new projects the coming year, with a lot of awesome experiments!<br />
Let&#8217;s all make it happen, together!</p>
<p>Happy new year!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2009/01/02/happy-new-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google API &#8211; AS3 Library</title>
		<link>http://www.joristimmerman.be/wordpress/2008/12/18/google-api-as3-library/</link>
		<comments>http://www.joristimmerman.be/wordpress/2008/12/18/google-api-as3-library/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 21:00:57 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[BoulevArt]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=16</guid>
		<description><![CDATA[A while ago, I have build an API library in AS3 that interfaces with Google’s own AJAX API. To show you how performant this API is, I included a demo-app at the bottom of this blog. The library is a simple collection of the API’s features, there is a class per feature, like Google Web [...]]]></description>
			<content:encoded><![CDATA[<p><!--StartFragment--></p>
<p style="text-align: center; ">
<p style="text-align: center;"><img class="size-medium wp-image-505   aligncenter" title="Google API: AS3 lib" src="http://labs.boulevart.be/wp-content/uploads/2008/12/googlewb1.jpg" alt="" width="133" height="100" /></p>
<p class="MsoNormal">
<p class="MsoNormal"><span lang="NL-BE">A while ago, I have build an API library in AS3 that interfaces with Google’s own AJAX API. To show you how performant this API is, I included a demo-app at the bottom of this blog.</span></p>
<p class="MsoNormal"><span lang="NL-BE">The library is a simple collection of the API’s features, there is a class per feature, like Google Web search, Images Search, etc. Each library throws it’s own event with an Array of matching datatypes, for example GoogleWebItem, so it’s easy to keep track on wich data is recieved and what this data contains.</span></p>
<p class="MsoNormal"><span lang="NL-BE">This api contains:</span></p>
<ul>
<li>Google Web Search</li>
<li>Google Images Search</li>
<li>Google Book Search</li>
<li>Google Video Search (Google Video &amp; YouTube)</li>
<li>Google Blog Search</li>
<li>Google Local Search</li>
<li>Google Patent Search</li>
<li>Google News Search</li>
<li>Google Translation</li>
<li>Google Weather</li>
<li>Google Suggest (new)</li>
</ul>
<p>This API is Flash &amp; Flex compatible.</p>
<p class="MsoNormal">
<h2><span lang="NL-BE">Little example code</span></h2>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> googleWebSearch:GoogleWebSearch=<span style="color: #000000; font-weight: bold;">new</span> GoogleWebSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
googleWebSearch.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span>txtInput.<span style="color: #0066CC;">text</span>,<span style="color: #cc66cc;">0</span>,lang<span style="color: #66cc66;">&#41;</span>
googleWebSearch.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>GoogleSearchEvent.<span style="color: #006600;">WEB_SEARCH_RESULT</span>,onWebResults<span style="color: #66cc66;">&#41;</span> 
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onWebResults<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:GoogleSearchEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
   <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> result:GoogleWebItem <span style="color: #b1b100;">in</span> <span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">data</span> as <span style="color: #0066CC;">Array</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>result.<span style="color: #006600;">title</span>, result.<span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h2>The library</h2>
<p>You can download the library <a href="http://googleas3api.googlecode.com/files/as3googleapilibs2.0.2.zip" onclick="pageTracker._trackPageview('/outgoing/googleas3api.googlecode.com/files/as3googleapilibs2.0.2.zip?referer=');">here</a> <span style="color: #ff0000;">(updated)</span>.<br />
The demo app can be found <a title="here" href="http://googleas3api.googlecode.com/files/GoogleEyes.air" target="_blank" onclick="pageTracker._trackPageview('/outgoing/googleas3api.googlecode.com/files/GoogleEyes.air?referer=');">here</a>.</p>
<p>Right-click in the app to see source-code.</p>
<p><!--EndFragment--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2008/12/18/google-api-as3-library/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FLVRecorder for Adobe AIR</title>
		<link>http://www.joristimmerman.be/wordpress/2008/12/18/flvrecorder-record-to-flv-using-air/</link>
		<comments>http://www.joristimmerman.be/wordpress/2008/12/18/flvrecorder-record-to-flv-using-air/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 21:00:33 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[BoulevArt]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[as3 webcam to flv]]></category>
		<category><![CDATA[webcam to flv]]></category>
		<category><![CDATA[writing flv]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=12</guid>
		<description><![CDATA[FLVRecorder for Adobe AIR About When I was researching earlier this year whether or not I could capture a webcam feed and save it to the Flash Video Format, I stumbled on a guys blog called Zero Point Nine. He made a class that could save frames (BitmapData objects) passed to it as an FLV. [...]]]></description>
			<content:encoded><![CDATA[<p><!--StartFragment--></p>
<h2><span lang="EN-GB">FLVRecorder for Adobe AIR</span></h2>
<h3><span lang="EN-GB">About</span></h3>
<p class="MsoNormal"><span lang="EN-GB">When I was researching earlier this year whether or not I could capture a webcam feed and save it to the Flash Video Format, I stumbled on a guys blog called Zero Point Nine. He made a class that could save frames (BitmapData objects) passed to it as an FLV.<span> </span></span></p>
<p class="MsoNormal"><span lang="EN-GB">This was nice, but not very performant, as the parsing of the BitmapData to ByteArrays took way too long and was extremely CPU intensive and your app froze up, I decided to adjust the class and make it usable within an Adobe AIR app without losing a single frame, or freezing the app. For this, I started out with a new class, only copied the algorithms for writing an FLV and started building my own api.<br />
The main target of developing this FLV-recorder was performance on the CPU and RAM side.</span></p>
<h3><span lang="EN-GB">FLVRecorder</span></h3>
<p> 
</p>
<p class="MsoNormal"><span lang="EN-GB">The purpose of this revolutionary new class is to record a stream of BitmapData to a FLV-file, because writing directly, and especially the converting-BitmapData-to-ByteArrays-with-byteshifting-part, made everything run shaky. I solved that issue by saving the BitmapData to a temporary file on the system. This to protect your RAM from overloading, and when done recording, the class converts that temporary file to an FLV-file.</span></p>
<p class="MsoNormal"><span lang="EN-GB">For developing comforts, I build in a few events as well, when recording starts and stops, and an event while saving, with an indication of your progress.</span></p>
<p class="MsoNormal"><span lang="EN-GB">The class offers the user to record via inputting BitmapData, Bitmaps and even your custom components, Flex component, like your VideoDisplay and also Flash components, like the FLVPlayBack or your custom Sprites and MovieClips.</span></p>
<p class="MsoNormal"><span lang="EN-GB">The class does not yet support adding sound to the flv-file, this is the next step of development, to enable sound recording and add sound to the flv-file.</span></p>
<p><!--EndFragment--><!--StartFragment--></p>
<h3><span lang="EN-GB">AirCam</span></h3>
<p class="MsoNormal"><span lang="EN-GB">As a proof-of-concept, I built a small application that enables you to record your webcam and saved it on your desktop as an flv-file.</span></p>
<div id="attachment_300" class="wp-caption alignnone" style="width: 310px"><a href="http://flvrecorder.googlecode.com/files/AirCam.air" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/AirCam.air?referer=');"><img class="size-medium wp-image-300" title="AirCam" src="http://labs.boulevart.be/wp-content/uploads/2008/09/webcam.png" alt="Screenshot of AirCam" width="300" height="268" /></a><p class="wp-caption-text">Screenshot of AirCam</p></div>
<p>Download the AirCam installer <a href="http://flvrecorder.googlecode.com/files/AirCam.air" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/AirCam.air?referer=');">here.<br />
</a>To view the source used in this project, right-click somewhere, and choose view source.</p>
<p>The FLVRecorder and all related classes are open source, they are not fully tested and may contain bugs.<br />
I&#8217;m happy to share it with the community, use them, play with them and certainly enhance them!<br />
These classes are NOT FOR COMMERCIAL USE and property of BoulevArt nv.</p>
<p>Download the <a href="http://flvrecorder.googlecode.com/files/flvrecorder_0.2.zip" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/flvrecorder_0.2.zip?referer=');">source.</a></p>
<p><span id="more-12"></span></p>
<h2>API</h2>
<p>The class offers the developer an API to easy implement this in your app.<br />
You should respect a certain flow:</p>
<p>1. Make an instance of the class, it&#8217;s a singleton class, so just ask for the instance:<br />
<span style="color: #33cccc;"><span style="white-space:pre"> </span>var</span> recorder:FLVRecorder=FLVRecorder.getInstance()</p>
<p>2. Define the target FLV-file&#8217;s properties, the file instance to your flv-file, width &amp; height, framerate and the systemManager instance, that&#8217;s a Flash internal declared variable and the optional duration in seconds:<br />
<span style="white-space:pre"> <span style="white-space:pre"> </span></span>file=File.desktopDirectory.resolvePath(<span style="color: #ff0000;">&#8220;recording</span><span style="color: #ff0000;">.flv&#8221;</span>);<br />
<span style="white-space:pre"> <span style="white-space:pre"> </span></span>recorder.setTarget(file,640,480,fps,systemManager, durationInSeconds)</p>
<p>the duration is optional, it will be automaticly filled in when left blank.</p>
<p>3. Insert some bitmaps, bitmapdatas or a screenshot of a component into the flv-file:<br />
<span style="white-space:pre"> </span>recorder.captureComponent(vidDisplay)	<span style="white-space:pre"> <span style="white-space:pre"> </span></span><span style="color: #339966;">//DisplayObject, takes a screenshot from that component<br />
<span style="color: #339966;"><span style="white-space:pre"><span style="color: #000000;"> </span></span><span style="color: #000000;">recorder.saveFrame(bmpdata) </span><span style="white-space:pre"><span style="color: #000000;"> </span><span style="white-space:pre"> </span></span></span><span style="color: #339966;">//Bitmapdata, does nothing with it<br />
<span style="color: #339966;"><span style="white-space:pre"><span style="color: #000000;"> </span></span><span style="color: #000000;">recorder. saveSmoothedBitmapFrame(bmp)</span></span><span style="color: #339966;"> </span><span style="white-space:pre"><span style="color: #339966;"> <span style="white-space:pre"> </span></span></span><span style="color: #339966;">//Bitmap, smooths before saving<br />
<span style="color: #339966;"><span style="white-space:pre"><span style="color: #000000;"> </span></span><span style="color: #000000;">recorder. saveSmoothedFrame(bmpdata)</span><span style="white-space:pre"> <span style="white-space:pre"> </span></span></span><span style="color: #339966;">//Bitmapdata, smooths bitmapdata before saving</span></span></span></span></p>
<p>4. To stop recording, simply command the class to stop, it will start to convert your saved data to the flv-file<br />
<span style="white-space:pre"> </span>recorder.stopRecording()</p>
<p><span style="white-space:pre"> </span>It will throw 3 events, when saving starts, when savings stops and one while saving to pass on the savings progress<br />
<span style="white-space:pre"> <span style="white-space:pre"> </span></span>FLVRecorderEvent.FLV_START_CREATION<br />
<span style="white-space:pre"> <span style="white-space:pre"> </span></span>FLVRecorderEvent.FLV_CREATED<br />
<span style="white-space:pre"> <span style="white-space:pre"> </span></span>FLVRecorderEvent.PROGRESS //event contains progress property, is a value between 0-1 to indicate progress</p>
<p>5. All done, that&#8217;s how simple things can be in life.</p>
<p>6. Test it, use it and give me feedback of your experiences!</p>
<p><!--StartFragment--></p>
<h3><span lang="EN-GB">How–to-use code example</span></h3>
<p><span style="color: #0000ff;">private</span> <span style="color: #33cccc;">var</span> tmr:Timer<br />
<span style="color: #0000ff;"> private</span> <span style="color: #33cccc;">var</span> recorder:FLVRecorder<br />
<span style="color: #0000ff;"> private</span> <span style="color: #33cccc;">var</span> file:File</p>
<p><span style="color: #0000ff;">private</span> <span style="color: #33cccc;">function</span> startRecording():<span style="color: #0000ff;">void</span>{</p>
<p><span style="white-space:pre"> </span><span style="color: #0000ff;">if</span>(recorder==<span style="color: #0000ff;">null</span>){<br />
<span style="white-space:pre"> </span>recorder=FLVRecorder.getInstance()<br />
<span style="white-space:pre"> </span>}<br />
<span style="white-space:pre"> </span>file=File.desktopDirectory.resolvePath(<span style="color: #ff0000;">&#8220;recording</span><span style="color: #ff0000;">.flv&#8221;</span>);<br />
<span style="white-space:pre"> </span>recorder.setTarget(file,640,480,fps,systemManager)</p>
<p><span style="white-space:pre"> </span>if(tmr==<span style="color: #0000ff;">null</span>){<br />
<span style="white-space:pre"> </span>tmr=<span style="color: #0000ff;">new</span> Timer(1000/fps)<br />
<span style="white-space:pre"> </span>}<br />
<span style="white-space:pre"> </span>tmr.addEventListener(TimerEvent.TIMER,record)<br />
<span style="white-space:pre"> </span>tmr.start()<br />
}</p>
<p><span style="color: #0000ff;">private</span> <span style="color: #33cccc;">function</span> record(e:TimerEvent):<span style="color: #0000ff;">void</span>{<br />
<span style="white-space:pre"> </span>recorder.captureComponent(vidDisplay)	<span style="white-space:pre"> </span><span style="color: #339966;">//DisplayObject</span><br />
<span style="white-space:pre"> </span><span style="color: #339966;">//recorder.saveFrame(bmpdata) </span><span style="white-space:pre"><span style="color: #339966;"> </span></span><span style="color: #339966;">//Bitmapdata<br />
</span><span style="white-space:pre"><span style="color: #339966;"> </span></span><span style="color: #339966;">//recorder. saveSmoothedBitmapFrame(bmp) </span><span style="white-space:pre"><span style="color: #339966;"> </span></span><span style="color: #339966;">//Bitmap<br />
</span><span style="white-space:pre"><span style="color: #339966;"> </span></span><span style="color: #339966;">//recorder. saveSmoothedFrame(bmpdata) </span><span style="white-space:pre"><span style="color: #339966;"> </span></span><span style="color: #339966;">//Bitmapdata</span><br />
}</p>
<p><span style="color: #0000ff;">private</span> <span style="color: #33cccc;">function</span> stopRecording():<span style="color: #0000ff;">void</span>{<br />
<span style="white-space:pre"> </span>tmr.stop()</p>
<p><span style="white-space:pre"> </span><span style="color: #339966;">//when saving is done</span><br />
<span style="white-space:pre"> </span>recorder.addEventListener(FLVRecorderEvent.FLV_CREATED,fileMade)</p>
<p><span style="white-space:pre"> </span><span style="color: #339966;">//when saving starts</span><br />
<span style="white-space:pre"> </span>recorder.addEventListener(FLVRecorderEvent.FLV_START_CREATION,startCreatingFLV)</p>
<p><span style="white-space:pre"> </span>recorder.stopRecording()<br />
}</p>
<p><span style="color: #0000ff;">private</span> <span style="color: #33cccc;">function</span> startCreatingFLV(e:FLVRecorderEvent):<span style="color: #0000ff;">void</span>{<br />
<span style="white-space:pre"> </span>recorder.addEventListener(FLVRecorderEvent.PROGRESS,onFLVCreationProgress)<br />
}</p>
<p><span style="color: #0000ff;">private</span> <span style="color: #33cccc;">function</span> onFLVCreationProgress(e:FLVRecorderEvent):<span style="color: #0000ff;">void</span>{<br />
<span style="white-space:pre"> </span><span style="color: #339966;">//e.progress: percent complete (0 to 1)<br />
</span><span style="white-space:pre"><span style="color: #339966;"> </span></span><span style="color: #339966;">//pbSaving: ProgressBar component in Flex</span><br />
<span style="white-space:pre"> </span>pbSaving.setProgress(e.progress,1)<br />
}</p>
<h2>Downloads</h2>
<p><a title="Download AirCam" href="http://flvrecorder.googlecode.com/files/AirCam.air" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/AirCam.air?referer=');"><img class="alignnone size-medium wp-image-278" title="Download AIRCam" src="http://labs.boulevart.be/wp-content/uploads/2008/09/128.png" alt="" height="128" /></a><a title="Download source" href="http://flvrecorder.googlecode.com/files/flvrecorder_0.2.zip" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/flvrecorder_0.2.zip?referer=');"><img class="alignnone size-medium wp-image-279" title="Download source" src="http://labs.boulevart.be/wp-content/uploads/2008/09/zip.png" alt="" height="128" /></a></p>
<h2>Contact!</h2>
<p>Share your opinion with us, leave a comment!<br />
Also tell me if you&#8217;re using the class, what you wanted to see different, share your enhancements!<br />
Don&#8217;t forget to show me what apps you made with these classes!</p>
<p>You can always reach me:<br />
just leave a comment!</p>
<h2>*UPDATE 1*</h2>
<p>Thanks for your feedbacks, I&#8217;ve updated the classes to help out a few of you.<br />
What is new:</p>
<p>An <em>enableCompression</em> property: will compress the captured image with the JPGEncoder<br />
Warning! Using this property will slow you application down.</p>
<p><em>Codecs</em>:<br />
Pick a codec. You can find the available codecs in the FlvRecorderCodecs class.</p>
<p><em>Pausing &amp; Resuming recordings</em>:<br />
You can pause &amp; resume recordings.<br />
If you stop feeding the class frames, and not call the stopRecording() function, and after a while, feeding it some frames again, it will add those frames to the current movie.</p>
<p><span style="text-decoration: underline;"><a href="http://flvrecorder.googlecode.com/files/flvrecorder_0.2.zip" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/flvrecorder_0.2.zip?referer=');">Download update here.</a></span></p>
<h2>*UPDATE 2*</h2>
<p>Because I am using a Pseudo-Threading  class that is using a specific Flex class, and a lot of you are Flash-only developers, I have released a library for Flash (AS3) on Google Code.<br />
<a title="FLVRecorder Flash" href="http://flvrecorder.googlecode.com/files/flvrecorder0.2_flash.zip" onclick="pageTracker._trackPageview('/outgoing/flvrecorder.googlecode.com/files/flvrecorder0.2_flash.zip?referer=');">Here is a link.</a></p>
<p><span style="text-decoration: underline;"><br />
</span></p>
<p><span style="text-decoration: underline;"><br />
</span></p>
<p><!--EndFragment--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2008/12/18/flvrecorder-record-to-flv-using-air/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Remoting and Flash CS3 AS2</title>
		<link>http://www.joristimmerman.be/wordpress/2008/12/18/remoting-and-flash-cs3-as2/</link>
		<comments>http://www.joristimmerman.be/wordpress/2008/12/18/remoting-and-flash-cs3-as2/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 20:53:15 +0000</pubDate>
		<dc:creator>Joris Timmerman</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Remoting & DB]]></category>
		<category><![CDATA[AS2 remoting]]></category>
		<category><![CDATA[Flash CS3]]></category>
		<category><![CDATA[Flash remoting]]></category>

		<guid isPermaLink="false">http://www.joristimmerman.be/wordpress/?p=3</guid>
		<description><![CDATA[Flash &#38; AS  Flash CS3 introduced AS3 and with this new version of ActionScript came a lot of extras. One of these extras is remoting, something that already existed since Flash MX. If you wanted to use remoting, you had to download an installer from the Macromedia download site, that contained the classes and components [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash &amp; AS </strong></p>
<p>Flash CS3 introduced AS3 and with this new version of ActionScript came a lot of extras. One of these extras is remoting, something that already existed since Flash MX.<br />
If you wanted to use remoting, you had to download an installer from the Macromedia download site, that contained the classes and components required to use this. They did this till Flash 8&#8230; <br />
But then there was AS3, and Adobe decided not to release the AS2 remoting components for this new version of Flash, Flash CS3, because they were build in for use with AS3. </p>
<p>But I found them!</p>
<p>You can download them <a title="Download rermoting components for Flash CS3 (AS2)" href="http://www.joristimmerman.be/downloads/cs3-as2_remoting.zip">here</a>.</p>
<p>Extract the files in a directory of your choice, for example d:\cs3remoting\ .<br />
In Flash CS3, goto Edit &gt; Preferences (or Flash &gt; Preferences for Mac),<br />
choose the category &#8216;ActionScript&#8217;, click on the button &#8216;ActionScript 2.0 Settings&#8230;&#8217;,<br />
click on the crosshair button and choose the directory were you extracted your components (f.e. &#8216;d:\cs3remoting\&#8217;).</p>
<p> Now your ready to use the remoting components in AS2.</p>
<p> A small code example: </p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">remoting</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #66cc66;">*</span>
&nbsp;
login_btn.<span style="color: #0066CC;">onRelease</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> gatewayUrl:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;http://joristimmerman.be/remotingengine/gateway.php&quot;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//gateway, logger,servicename</span>
service = <span style="color: #000000; font-weight: bold;">new</span> Service<span style="color: #66cc66;">&#40;</span>gatewayUrl, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #ff0000;">&quot;ClassroomLoginService&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> login:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
login.<span style="color: #006600;">userName</span> = username_txt.<span style="color: #0066CC;">text</span>;
login.<span style="color: #0066CC;">password</span> = pwd_txt.<span style="color: #0066CC;">text</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> pc:PendingCall = service.<span style="color: #006600;">verifyLoginExists</span><span style="color: #66cc66;">&#40;</span>login<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//target,successfunc,failfunc</span>
pc.<span style="color: #006600;">responder</span> = <span style="color: #000000; font-weight: bold;">new</span> RelayResponder<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_root</span>, <span style="color: #ff0000;">&quot;handleLogin&quot;</span>, <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> handleLogin<span style="color: #66cc66;">&#40;</span>re:ResultEvent<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">var</span> rs:RecordSet = RecordSet<span style="color: #66cc66;">&#40;</span>re.<span style="color: #006600;">result</span><span style="color: #66cc66;">&#41;</span>;
     <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; j <span style="color: #66cc66;">&amp;</span>lt; rs.<span style="color: #0066CC;">length</span>; j++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
         <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>j<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">username</span><span style="color: #66cc66;">&#41;</span>;
     <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p> Whish you good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joristimmerman.be/wordpress/2008/12/18/remoting-and-flash-cs3-as2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

