<?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>RandomAccess</title>
	<atom:link href="http://www.randomaccess.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randomaccess.org</link>
	<description></description>
	<lastBuildDate>Mon, 23 Nov 2009 21:09:25 +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>3 ways to reduce redundant code in your adobe flash actionscript 3 projects</title>
		<link>http://www.randomaccess.org/2009/11/3-ways-to-reduce-redundant-code-in-your-adobe-flash-actionscript-3-projects/</link>
		<comments>http://www.randomaccess.org/2009/11/3-ways-to-reduce-redundant-code-in-your-adobe-flash-actionscript-3-projects/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 21:09:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=126</guid>
		<description><![CDATA[There is 3 great ways to reduce redundant code in your actionscript 3 projects:
1) Aggregation 
If objects A and B has same function, why not put that function on a separate object C and let both other objects call it from there.
2) Composition ie. inheritance
Put your redundant code to a class C and let your [...]]]></description>
			<content:encoded><![CDATA[<p>There is 3 great ways to reduce redundant code in your actionscript 3 projects:</p>
<p><strong>1) Aggregation </strong></p>
<p>If objects A and B has same function, why not put that function on a separate object C and let both other objects call it from there.</p>
<p><strong>2) Composition ie. inheritance</strong></p>
<p>Put your redundant code to a class C and let your objects A and B inherit those methods from there.</p>
<p><strong>3) Last but not least: include -statement</strong></p>
<p>Sometimes good old include -statement is best way to go. Just put your code on separate file and include it where ever it&#8217;s needed. Quick, dirty and powerfull! <img src='http://www.randomaccess.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Included code doesn&#8217;t even have to be full class or  function, but any usefull bit of code will do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/11/3-ways-to-reduce-redundant-code-in-your-adobe-flash-actionscript-3-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clearer adobe actionscript AS3 code by using objects as function parameters</title>
		<link>http://www.randomaccess.org/2009/11/clearer-adobe-actionscript-as3-code-by-using-objects-as-function-parameters/</link>
		<comments>http://www.randomaccess.org/2009/11/clearer-adobe-actionscript-as3-code-by-using-objects-as-function-parameters/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 12:02:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=117</guid>
		<description><![CDATA[Classical implementation of a Adobe flash actionscript function could be something like this:
function doSquareThing(x,y,width,height,fillcolor,bordercolor,callback){
      //Do something with the parameters
}

doSquareThing(10,20,15,15,#cccccc,#000000,squareReady);
Everytime you call the function you have to remember what order the parameters should be. If somebody else is reading the code he/she can&#8217;t know what the parameters are without seeing documentation [...]]]></description>
			<content:encoded><![CDATA[<p>Classical implementation of a Adobe flash actionscript function could be something like this:</p>
<pre>function doSquareThing(x,y,width,height,fillcolor,bordercolor,callback){
      //Do something with the parameters</pre>
<pre>}

doSquareThing(10,20,15,15,#cccccc,#000000,squareReady);</pre>
<p>Everytime you call the function you have to remember what order the parameters should be. If somebody else is reading the code he/she can&#8217;t know what the parameters are without seeing documentation or function definition.</p>
<p>Better way to do the same thing is <span id="more-117"></span>to use a object as a function parameter. This way you will get much more human readable code. something like this:</p>
<pre>function doSquareThing(settings){
      // do something with the parameters: settings.x settings.callback etc.
}
<pre>doSquareThing({
   x:10,
   y:20,
   width:15,
   height:15,
   fillcolor:#cccccc,
   bordercolor:#000000,
   callback:squareReady</pre>
<pre>});</pre>
</pre>
<p>it takes a few more lines, but instantly you know what parameters function call is passing and they can also be in any order.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/11/clearer-adobe-actionscript-as3-code-by-using-objects-as-function-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe flash actionscript as3 mask movieclips with gradient alpha masks</title>
		<link>http://www.randomaccess.org/2009/11/adobe-flash-actionscript-as3-mask-movieclips-with-gradient-alpha-masks/</link>
		<comments>http://www.randomaccess.org/2009/11/adobe-flash-actionscript-as3-mask-movieclips-with-gradient-alpha-masks/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 21:48:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=108</guid>
		<description><![CDATA[With actionscript as3  you can ad a mask to a display object ie. movieclip with simple line of code.
mc_to_be_masked.mask = masking_mc;
But this will usually ignore any alpha gradients you might have in your masking movie clip.
To make the masking work  properly, you have to set everything to be caches as bitmaps. Both mask and movieclip [...]]]></description>
			<content:encoded><![CDATA[<p>With actionscript as3  you can ad a mask to a display object ie. movieclip with simple line of code.</p>
<pre>mc_to_be_masked.mask = masking_mc;</pre>
<p>But this will usually ignore any alpha gradients you might have in your masking movie clip.</p>
<p>To make the masking work  properly, you have to<span id="more-108"></span> set everything to be caches as bitmaps. Both mask and movieclip that is going to be masked.</p>
<pre>mc_to_be_masked.cacheAsBitmap = true;
masking_mc.cacheAsBitmap = true;
mc_to_be_masked.mask = masking_mc;</pre>
<p>Tadaa, masks alpha properties should work as expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/11/adobe-flash-actionscript-as3-mask-movieclips-with-gradient-alpha-masks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash textfields styling with CSS line-height</title>
		<link>http://www.randomaccess.org/2009/11/flash-textfields-styling-with-css-line-height/</link>
		<comments>http://www.randomaccess.org/2009/11/flash-textfields-styling-with-css-line-height/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 21:06:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=104</guid>
		<description><![CDATA[Flash textfields doesn&#8217;t support css line-height property. But they do support property &#8220;leading&#8221;. Default value for leading is 0.
So for smaller line-height between lines of textfield you have to set leading on a css -style to negative values and vice versa for bigger line-height.
Something like this for decreased line-height:
.mystyle{
leading:-2px;
}
]]></description>
			<content:encoded><![CDATA[<p>Flash textfields doesn&#8217;t support css line-height property. But they do support property &#8220;leading&#8221;. Default value for leading is 0.</p>
<p>So for smaller line-height between lines of textfield you have to set leading on a css -style to negative values and vice versa for bigger line-height.</p>
<p>Something like this for decreased line-height:</p>
<p>.mystyle{<br />
leading:-2px;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/11/flash-textfields-styling-with-css-line-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Gmail address is many</title>
		<link>http://www.randomaccess.org/2009/11/one-gmail-address-is-many/</link>
		<comments>http://www.randomaccess.org/2009/11/one-gmail-address-is-many/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 00:31:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[gmail]]></category>
		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=96</guid>
		<description><![CDATA[If you have Gmail account you actually have several working email addresses. Gmail ignores . -charaters on emails addresses, so everyone of these email addresses will be directed to the same Gmail account:
forename.surename@gmail.com
forenamesurename@gmail.com
f.o.r.e.n.a.m.e.surename@gmail.com
f.o.r.e.n.a.m.e.s.u.r.e.n.a.m.e@gmail.com
Next time you will need a new email address, for example to register to same service twice, look no further than your gmail [...]]]></description>
			<content:encoded><![CDATA[<p>If you have Gmail account you actually have several working email addresses. Gmail ignores . -charaters on emails addresses, so everyone of these email addresses will be directed to the same Gmail account:</p>
<p>forename.surename@gmail.com<br />
forenamesurename@gmail.com<br />
f.o.r.e.n.a.m.e.surename@gmail.com<br />
f.o.r.e.n.a.m.e.s.u.r.e.n.a.m.e@gmail.com</p>
<p>Next time you will need a new email address, for example to register to same service twice, look no further than your gmail account.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/11/one-gmail-address-is-many/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Globals in flash as3</title>
		<link>http://www.randomaccess.org/2009/09/globals-in-as3/</link>
		<comments>http://www.randomaccess.org/2009/09/globals-in-as3/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 06:04:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=41</guid>
		<description><![CDATA[Actionscript 3 doesn&#8217;t have build-in global variables. Globals are however easy to implement with just one small class with a public static object. Just three easy steps.
1) Make a new class with a public static variable (..or just download example files here)
package org.randomaccess.utility{
    public class Gb
    {
   [...]]]></description>
			<content:encoded><![CDATA[<p>Actionscript 3 doesn&#8217;t have build-in global variables. Globals are however easy to implement with just one small class with a public static object. Just three easy steps.<span id="more-41"></span></p>
<p><strong>1) Make a new class with a public static variable</strong> (..or just download example files <a href="http://www.randomaccess.org/wp-content/uploads/2009/09/globals_for_as3.zip">here</a>)</p>
<pre>package org.randomaccess.utility{
    public class Gb
    {
          public static var vars:Object = new Object();
    }
}</pre>
<p><strong>2) Import globals class to your own classes</strong></p>
<pre>import org.randomaccess.utility.Gb;</pre>
<p><strong>3) Use global variables like this:</strong></p>
<pre>Gb.vars.message_1 = "This is a global message";
Gb.vars.another_variable = "This is another global variable";</pre>
<p><a href="http://www.randomaccess.org/wp-content/uploads/2009/09/globals_for_as3.zip">DOWNLOAD EXAMPLE FILES</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/09/globals-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 main class &#8211;  interaction between methods and timeline (for beginners)</title>
		<link>http://www.randomaccess.org/2009/09/as3-main-class-methods-and-timeline/</link>
		<comments>http://www.randomaccess.org/2009/09/as3-main-class-methods-and-timeline/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 11:52:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.randomaccess.org/?p=63</guid>
		<description><![CDATA[After you have setup main class for your flash project, and perhaps put it in to a package, you can start writing code for your application.
Calling timeline from main class


On main class you can access timeline straight from the code.  Write stop(); to your main class and it will stop the playback of timeline.
package org.randomaccess{
	import [...]]]></description>
			<content:encoded><![CDATA[<p>After you have <a href="http://www.randomaccess.org/2009/09/beginners-start-with-as3/">setup main class for your flash project</a>, and perhaps <a href="http://www.randomaccess.org/2009/09/using-packages-in-as3-for-beginners/">put it in to a package</a>, you can start writing code for your application.</p>
<p><strong>Calling timeline from main class</strong></p>
<p><strong><span id="more-63"></span><br />
</strong></p>
<p>On main class you can access timeline straight from the code.  Write stop(); to your main class and it will stop the playback of timeline.</p>
<pre>package org.randomaccess{
	import flash.display.MovieClip;
	public class MyApplication extends MovieClip{

		 function MyApplication(){
                           /*
                          On main class you can access timeline straight from the code.
                          stop(); refers to the maintimeline and stops it.
                          */
                          stop();
		 }
	 }
}</pre>
<p><strong>Calling main classes methods from the timeline</strong></p>
<p>Visa versa you can also refer straight to the main classes methods from the timeline. Add to your main class new method aka function:</p>
<pre>  function myGotoAndStop(frame){
			 // This method is called on main timeline.
			// As this is the main class, you can call the main timeline directly.
			gotoAndStop(frame);

		 }</pre>
<p>On first frame of your main timeline put command:</p>
<pre>myGotoAndStop(10);</pre>
<ul>
<li>Now the main class first stops the timeline on the first frame.</li>
<li>On the first frame timeline calls the main classes function myGotoAndStop()</li>
<li>myGotoAndStop() makes the timeline to go to the frame 10</li>
</ul>
<p>Calling main classes methods from timeline is quite straightforward. </p>
<p>However, usually there shouldn&#8217;t be any reason to put any code to the timeline. It&#8217;s always better to write your code on methods and classes to keep them in nice, reusable order.</p>
<p><a href="http://www.randomaccess.org/blog/wp-content/uploads/2009/09/main_class_and_timeline.zip">Download files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/09/as3-main-class-methods-and-timeline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using packages in flash AS3 (for beginners)</title>
		<link>http://www.randomaccess.org/2009/09/using-packages-in-as3-for-beginners/</link>
		<comments>http://www.randomaccess.org/2009/09/using-packages-in-as3-for-beginners/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 14:45:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://randomaccess.org/blog/?p=13</guid>
		<description><![CDATA[Many people, when starting with flash actionscript 3 developement, first save all the class files to the same folder as the main Flash file (.fla). It works allright when applications are small and you don&#8217;t have to share them with anybody.
However, there is a better way to organise your code, that&#8217;s called packages ( That&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Many people, when starting with flash actionscript 3 developement, first save all the class files to the same folder as the main Flash file (.fla). It works allright when applications are small and you don&#8217;t have to share them with anybody.</p>
<p>However, there is a better way to organise your code, that&#8217;s called packages ( That&#8217;s a fancy object oriented  name for subfolders)<span id="more-13"></span></p>
<p><strong>Naming the packages</strong></p>
<p>Common method for naming packages ie. folders is to use your companys or your own domain name. It&#8217;s convenient method as it provides unique paths for your code. Unique paths prevents your file names clashing with other peoples / companies code when you use their code or they use your classes.</p>
<p><strong>Make folders for your packages</strong></p>
<ol>
<li>On the same folder where you have your flash (.fla) file create a  subfolder. Name  it according to your top-level domain ie. com, net, org etc.</li>
<li>On that folder make a subfolder named with your domain name. For us the folders would be org\randomaccess\</li>
<li>Move all your class files to that folder</li>
</ol>
<p><strong>Declare the new location in your .as class files</strong></p>
<p>On .as files you define the package with dot syntax. For example: &#8221; <em>package org.randomaccess</em><strong>&#8221; </strong>simply means that &#8220;This file is located to a folder org\randomaccess\&#8221;</p>
<pre>package org.randomaccess{

   import flash.display.MovieClip;

   public class MyApplication extends MovieClip{

      public function MyApplication(){
         trace("hello world")
      }
   }
}</pre>
<p><strong><br />
<img class="alignright size-full wp-image-29" title="main_class_package" src="http://randomaccess.org/wp-content/uploads/2009/09/main_class_package.jpg" alt="main_class_package" />Modify your main .fla to use your class in the new location ie. package</strong></p>
<p>On your flash (.fla) documents properties -&gt; publish -&gt; class write the new location of  your main class, with dot syntax.</p>
<p>For example: “org.randomaccess.MyApplication”</p>
<p><a href="http://randomaccess.org/wp-content/uploads/2009/09/my_first_application_with_package.zip">Download example files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/09/using-packages-in-as3-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe AS 3 start (for beginners)</title>
		<link>http://www.randomaccess.org/2009/09/beginners-start-with-as3/</link>
		<comments>http://www.randomaccess.org/2009/09/beginners-start-with-as3/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 13:47:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[as3]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[adobe flash]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://randomaccess.org/blog/?p=3</guid>
		<description><![CDATA[Adobe Actionscript 3 based flash project (with flash IDE) has a bit different file structure, than traditional Adobe flash project. Every as3 flash application has a main class where the hole application starts.
Setup a main class to have a starting point for your as3 code
1. ) Create a new actionscript file (as3) and add some [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-22" style="margin: 10px;" title="new_actionscript_file" src="http://randomaccess.org/wp-content/uploads/2009/09/new_actionscript_file.jpg" alt="new_actionscript_file" />Adobe Actionscript 3 based flash project (with flash IDE) has a bit different file structure, than traditional Adobe flash project. Every as3 flash application has a main class where the hole application starts.<span id="more-3"></span></p>
<p><strong>Setup a main class to have a starting point for your as3 code</strong></p>
<p><strong>1. ) </strong>Create a new actionscript file (as3) and add some code to it:</p>
<pre>/*
This class is located to the same folder as main .fla file
so there is no package ie. subfolder defined.
*/

package{

	/*
	You have to import all the other classes that this class uses.
	Also flashes own classes like MovieClip
	*/
	import flash.display.MovieClip;

	/*
	Class has to be public to be used by other classes.
	Applications main class has to always extend flashes own MovieClip class
	*/
	public class MyApplication extends MovieClip{

		  /*
		  Main function is called when class is initiated.
		  It's name has to be the same as the classes name
		  */
          function MyApplication(){
             trace("Hello world!")
         }

    }

}</pre>
<p><strong>2.) </strong>Save the actionscript file with name &#8220;MyApplication.as&#8221;</p>
<p><strong>3.)</strong> Make a new flash document</p>
<p><img class="alignright size-full wp-image-21" title="main_class" src="http://randomaccess.org/wp-content/uploads/2009/09/main_class.jpg" alt="main_class" /><strong>4.) </strong>On documents properties -&gt; publish -&gt; class write the name for your main class, for example: &#8220;MyApplication&#8221;</p>
<p><strong>5.)</strong> Save the flash document to the same folder as your MyApplication.as file</p>
<p><strong>6.)</strong> Test the flash movie!</p>
<p><strong>On the Output panel you will see the &#8220;Hello world!&#8221; -message</strong></p>
<p><a href="http://randomaccess.org/wp-content/uploads/2009/09/my_first_application.zip">Download files</a></p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.randomaccess.org/2009/09/beginners-start-with-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

