<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>David Harris&apos;s Technology Blog - Action Script</title>
			<link>http://www.harrisfamily.net.nz/devblog/index.cfm</link>
			<description>ColdFusion, Flex and the Universe...</description>
			<language>en-us</language>
			<pubDate>Wed, 08 Sep 2010 06:22:58 -0500</pubDate>
			<lastBuildDate>Fri, 18 Dec 2009 04:58:00 -0500</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>harrisfamily.net.nz@gmail.com</managingEditor>
			<webMaster>harrisfamily.net.nz@gmail.com</webMaster>
			
			<item>
				<title>Getting Red from my color</title>
				<link>http://www.harrisfamily.net.nz/devblog/index.cfm/2009/12/18/Getting-Red-from-my-color</link>
				<description>
				
				I have a situation where I want to manipulate colors in flash.

The idea is that the colors will cross fade nicely from one shade to another.

While you can define colors like this: 0xef556ef

that is stored as a unit data type.

Looking at the above string, it&apos;s 8 char in length.

The first two &quot;0x&quot; tell flash to treat this string as a hexadecimal value.

the next two &quot;ef&quot; are the red value, the next two &quot;55&quot; are green and the last 2 &quot;ef&quot; are blue.

Given the above value, I wanted to get the red shade of it, and only the red shade.

This is what I came up with:

&lt;code&gt;

var myColor 		: uint = 0xef556ef

//convert the color to a string on a hex base and get the first 2 chars with &quot;0x&quot; at the front

var redValueString	:String = &quot;0x&quot; + myColor.toString( 16 ).substr(0,2);
				
trace( redValueString );

//convert the sting to the int value

var redValueInt		: int = int( redValueString );
				
trace( redValueInt.toString() );

&lt;/code&gt;

This does give me the result, which is good, but I&apos;m no flash pro, so is there a better (right?) way to do it?

Feel free to tell me if there is! 
				</description>
				
				<category>Action Script</category>				
				
				<pubDate>Fri, 18 Dec 2009 04:58:00 -0500</pubDate>
				<guid>http://www.harrisfamily.net.nz/devblog/index.cfm/2009/12/18/Getting-Red-from-my-color</guid>
				
			</item>
			
			<item>
				<title>Simple Example of Randomizing the order of an array in ActionScript</title>
				<link>http://www.harrisfamily.net.nz/devblog/index.cfm/2009/4/16/Simple-Example-of-Randomizing-the-order-of-an-array-in-ActionScript</link>
				<description>
				
				Just got asked this by a work mate and after asking Mr Google and looking at the Array Documentation came up with this (Flex based) example, so thought I would share :-)

&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;
&gt;
&lt;mx:Script&gt;
&lt;![CDATA[
private function myExample() : void
{
//can be an array of anything you like, but using letters here

var myArray	: Array	= ( &quot;a,b,c,d,e,f,g,h,j,k,l&quot; ).split(&quot;,&quot;);

//sort the array using my function

myArray.sort( myFunction );

debug.text = myArray.toString() + &quot;\n&quot; + debug.text;
}

//This function takes in 2 args, but we never use them...

private function myFunction( a : Object , b : Object ) : int
{
return ( Math.round( Math.random() * 10 ) - 5);// return a random value above, below or on 0
}
]]&gt;
&lt;/mx:Script&gt;

&lt;mx:Button
label=&quot;Make me Random&quot;
click=&quot;myExample();&quot;
/&gt;

&lt;mx:TextArea
id	= &quot;debug&quot;
height=&quot;100%&quot;
/&gt;

&lt;/mx:Application&gt;
&lt;/code&gt; 
				</description>
				
				<category>Action Script</category>				
				
				<category>Flash</category>				
				
				<category>Flex</category>				
				
				<pubDate>Thu, 16 Apr 2009 15:10:00 -0500</pubDate>
				<guid>http://www.harrisfamily.net.nz/devblog/index.cfm/2009/4/16/Simple-Example-of-Randomizing-the-order-of-an-array-in-ActionScript</guid>
				
			</item>
			</channel></rss>