<?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>Cata.printBlog(); &#187; download</title>
	<atom:link href="http://cata.onsysol.com/blog/tag/download/feed/" rel="self" type="application/rss+xml" />
	<link>http://cata.onsysol.com/blog</link>
	<description>... it&#039;s about software!</description>
	<lastBuildDate>Sun, 30 May 2010 13:19:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS2Loader &#8211; Loading AS2 into AS3</title>
		<link>http://cata.onsysol.com/blog/2009/10/as2loader-loading-as2-into-as3/</link>
		<comments>http://cata.onsysol.com/blog/2009/10/as2loader-loading-as2-into-as3/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 19:09:54 +0000</pubDate>
		<dc:creator>Catalin Ciocov</dc:creator>
				<category><![CDATA[Action Script]]></category>
		<category><![CDATA[actionscript2]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[library]]></category>

		<guid isPermaLink="false">http://cata.onsysol.com/blog/?p=11</guid>
		<description><![CDATA[Loading as AS2 SWF into AS3 is possible using the Loader class, but that won&#8217;t help in case you also need to communicate with the loaded AS2 SWF. The trick is to create a wrapper AS2 SWF that will act as a proxy (or say bridge) between the host AS3 SWF and the target AS2 [...]]]></description>
			<content:encoded><![CDATA[<p>Loading as AS2 SWF into AS3 is possible using the Loader class, but that won&#8217;t help in case you also need to communicate with the loaded AS2 SWF. The trick is to create a wrapper AS2 SWF that will act as a proxy (or say bridge) between the host AS3 SWF and the target AS2 SWF. The bridge SWF will be loaded in the host AS3 SWF while the target AS2 SWF will be loaded inside the bridge.</p>
<p>Because I needed this quite a lot in one of the applications I&#8217;m working on, I&#8217;ve decided to create a class (AS2Loader) that will simplify the process of loading and communicating with ActionScript 2 SWFs from ActionScript 3. Here&#8217;s what you can do with it:</p>
<p>Suppose you have an AS3 SWF in which you want to load (and then communicate with) an AS2 SWF named &#8220;as2movieclip.swf&#8221;. Using the AS2Loader class you will do something like this:</p>
<pre>import com.onsysol.as3.AS2Loader.*;

var as2ldr:AS2Loader = new AS2Loader();
as2ldr.addEventListener('AS2LoadInit', onAS2LoadInit);
as2ldr.load(new URLRequest('as2movieclip.swf'));

// this is triggered when the 1st frame of "as2movieclip.swf"
// is loaded and initialized:
function onAS2LoadInit(e:AS2LoaderEvent) {
    addChild(AS2Loader(e.target));
}</pre>
<p>The above code will load the AS2 SWF and once loaded it will add it to the display list. Next, you can register event listeners or make function calls on the AS2 SWF. The nice thing about this is that you can also request to receive back the return value of the function calls you make (since under the hood this is using Local Connection objects the return value of the function calls you make will be delivered through AS2LoaderEvents). So let&#8217;s proceed.</p>
<p>Suppose our AS2 SWF dispatches an &#8220;ABC&#8221; event. The following piece of code will register an event listener for this event:</p>
<pre>as2ldr.addEventListenerOnAS2('ABC', onABCEvent);
...
function onABCEvent(e:AS2LoaderEvent) {
    // the original AS2 event object is accessible through
    // e.data.eventObj:
    trace(e.data.eventObj.type + ' event dispatched from AS2.');
}</pre>
<p>If you want to call a function on the AS2 SWF (eg: gotoAndPlay() or stop() or anything else that&#8217;s public) you&#8217;ll do it like this (the following code assumes there&#8217;s a function say(s:String) defined on the AS2 SWF):</p>
<pre>as2ldr.callAS2Method('say', 'hello from AS3');</pre>
<p>In case you need to call a function on the AS2 SWF and also get the return value there&#8217;s no problem. Assuming there&#8217;s a function sum(a, b) that returns the sum of a and b, the following code will call sum() on the AS2 and also request and process the return value.</p>
<pre>as2ldr.getAS2MethodResult('sum', 2, 5);

// to get the return value from sum, we need to register an event
// listener on the AS2Loader object:
as2ldr.addEventListener('onAS2sumResult', onAS2SumResult);

function onAS2SumResult(e:AS2LoaderEvent) {
    trace('The result of 2 + 5 is ' + e.data.result);
}</pre>
<p>As you can see from the above example, if you call a function and also request its return value, the AS2Loader object will dispatch an event named &#8220;onAS2[function name]Result&#8221; when the return value is available.</p>
<p>I&#8217;ve created a test/demo page <a href="http://cata.onsysol.com/as2loader/" target="_blank">here</a>. You can also <a href="http://cata.onsysol.com/downloads/as2loader.zip">download the AS2Loader class and the example page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://cata.onsysol.com/blog/2009/10/as2loader-loading-as2-into-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Tools That Make Your Life Easier</title>
		<link>http://cata.onsysol.com/blog/2009/09/small-tools-that-make-your-life-easier/</link>
		<comments>http://cata.onsysol.com/blog/2009/09/small-tools-that-make-your-life-easier/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 18:04:01 +0000</pubDate>
		<dc:creator>Catalin Ciocov</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[minify javascript]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://cata.onsysol.com/blog/?p=8</guid>
		<description><![CDATA[If you&#8217;re actively doing development work and your production server is different from the development one, as it is in my case, at some point you&#8217;ll need to upload or deploy files from the development server to production. If this happens a lot during the day or even once a day, you might want to [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re actively doing development work and your production server is different from the development one, as it is in my case, at some point you&#8217;ll need to upload or deploy files from the development server to production. If this happens a lot during the day or even once a day, you might want to automate the deployment process.</p>
<p>I&#8217;ve created 2 small shell (PHP) scripts that will do just that, one using RSYNC/SSH and the other one plain FTP (you need to have <a href="http://www.ncftp.com/ncftp/">ncftp</a> installed). Here&#8217;s how to use them:</p>
<pre>$&gt; cd dir_to_deploy/
$&gt; deploy now</pre>
<p>Or, for the deployment via FTP:</p>
<pre>$&gt; cd dir_to_deploy/
$&gt; ftpdeploy</pre>
<p>It&#8217;s quite simple! Assuming you&#8217;ve installed the scripts in your path (with +x permission) you just go to the directory you want deployed and issue the above commands. You will be asked for the required information, such as host, user, pass, remote path, etc&#8230; the nice thing is that this information is saved on a per directory basis, so the next time you deploy you don&#8217;t have to enter it again, unless you want to change something, of course!</p>
<p>These tools were specially created to deploy applications made with <a href="http://my-framework.com">My Framework</a>, but they will work in almost any situation. You also have options to exclude certain files from deployment (like log and temporary files), but to find out how either ask me by posting a comment or read the source code.</p>
<p>Another tool I created that&#8217;s also available to download at the end of this post might help you if you want to minify and compress your JS files. It uses a PHP library that you can find <a href="http://code.google.com/p/jsmin-php/">here</a>.  It is a very good practice to minify and compress your JS files because you save a lot of bandwidth, especially if you&#8217;re web server is configured to serve compressed Javascript for browsers that support this (almost all!).</p>
<p>Suppose you have a JS file named &#8220;myjsfile.js&#8221;. To minify it, simply use:</p>
<pre>$&gt; minifyjs myjsfile.js</pre>
<p>The above command will create 2 new files in the same directory as the target file, named &#8220;myjsfile.min.js&#8221; and &#8220;myjsfile.min.js.gz&#8221;. You figured out what these are, right?</p>
<p>Download these tools <a href="http://cata.onsysol.com/downloads/smalldevtools.tar.gz">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://cata.onsysol.com/blog/2009/09/small-tools-that-make-your-life-easier/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash Remoting</title>
		<link>http://cata.onsysol.com/blog/2009/09/flash-remoting/</link>
		<comments>http://cata.onsysol.com/blog/2009/09/flash-remoting/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 15:12:27 +0000</pubDate>
		<dc:creator>Catalin Ciocov</dc:creator>
				<category><![CDATA[Action Script]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[AMF]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[flash remoting]]></category>
		<category><![CDATA[library]]></category>

		<guid isPermaLink="false">http://cata.onsysol.com/blog/?p=4</guid>
		<description><![CDATA[I&#8217;ve been doing a lot of Action Script recently and needed a good library for making flash remoting calls. If you Google a bit you&#8217;ll find a very good one (for AS3) here. I&#8217;ve started with this one, but because I needed some additional features I&#8217;ve decided to create my own version.
Specifically, I wanted the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a lot of Action Script recently and needed a good library for making flash remoting calls. If you Google a bit you&#8217;ll find a very good one (for AS3) <a href="http://osflash.org/as3lrf">here</a>. I&#8217;ve started with this one, but because I needed some additional features I&#8217;ve decided to create my own version.</p>
<p>Specifically, I wanted the ability to specify a time limit for remoting calls and have multiple ways of getting the result back (since it&#8217;s an asynchronous call). Here are some examples.</p>
<p>Connect the the remote service:</p>
<pre>import com.onsysol.remoting.*;

var service:RemoteService = new RemoteService('http://myserver.com/gateway.php', 'MyService');
service.connect();</pre>
<p>Make a remote call to MyMethod() and receive the result via event listeners:</p>
<pre>service.addEventListener('onMyMethodResult', onMyMethodResult);
service.addEventListener('onMyMethodFault', onMyMethodFault);
service.MyMethod('param1', 'param2', 'etc...');

function onMyMethodResult(e:ResultEvent) {
    trace(e.result);
}

function onMyMethodFault(e:FaultEvent) {
    trace(e.fault);
}</pre>
<p>In case you don&#8217;t want to use an event listener for every remoting call you make you can simply listen for a &#8220;default&#8221; event triggered after every remoting call that doesn&#8217;t have a specific event listener registered for it. So, instead of the above, you could have:</p>
<pre>service.addEventListener(ResultEvent.RESULT, onResult);
service.addEventListener(FaultEvent.FAULT, onFault);
service.MyMethod();

function onResult(e:ResultEvent) {
    trace('Result event received from ' + e.prop['methodName']);
    trace(e.result);
}

function onFault(e:FaultEvent) {
    trace('Fault event received from ' + e.prop['methodName']);
    trace(e.fault);
}</pre>
<p>And finally, if you don&#8217;t want to use events at all to get the response, you could use callback/anonymous functions, like this:</p>
<pre>var prop:Object = {
    onResultCallback: function(result:Object, prop:Object) {
        trace('do something in your function...');
    },
    onFaultCallback: function(fault:Object, prop:Object) {
    }
};
service.call('MyMethod', prop, 'param1', 'param2', 'etc...');</pre>
<p>The default timeout is 2 seconds, but you can specify a new timeout value for all calls or on a per call basis:</p>
<pre>// General timeout value, used for all calls that don't have a specific timeout:
RemoteService.TIMEOUT = 5000;   // 5 seconds

// Make a remoting call with timeout set to 20 seconds:
service.call('MyMethod', {timeout: 20000}, 'param1', '...');</pre>
<p>You can handle timeouts by either registering specific event listeners (onMyMethodTimeout), using the generic event (onTimeout) or using callback/anonymous function (onTimeoutCallback) in a similar way to how a result or a fault is handled.</p>
<p>Download the library <a href="http://cata.onsysol.com/downloads/flashremoting.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://cata.onsysol.com/blog/2009/09/flash-remoting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
