<?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>Jim&#039;s Code Bucket &#187; Actionscript</title>
	<atom:link href="http://jamesborder.com/category/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamesborder.com</link>
	<description>misc code snippets</description>
	<lastBuildDate>Mon, 16 Aug 2010 15:29:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS3 &#8211; button to javascript alert</title>
		<link>http://jamesborder.com/2010/03/as3-button-to-javascript-alert/</link>
		<comments>http://jamesborder.com/2010/03/as3-button-to-javascript-alert/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 19:27:06 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=500</guid>
		<description><![CDATA[
butt_shareThis.addEventListener(MouseEvent.CLICK, butt_shareThis_CLICK);
function butt_shareThis_CLICK(e:MouseEvent):void {
	// this line sends it to the standard alert box
	navigateToURL(new URLRequest("javascript:alert('SHARE THIS Test');"), "_self");
	// this line sends it console.log
	navigateToURL(new URLRequest("javascript:console.log('SHARE THIS Test to console.log');"), "_self");
}
]]></description>
			<content:encoded><![CDATA[<p><code><br />
butt_shareThis.addEventListener(MouseEvent.CLICK, butt_shareThis_CLICK);<br />
function butt_shareThis_CLICK(e:MouseEvent):void {</p>
<p>	// this line sends it to the standard alert box<br />
	navigateToURL(new URLRequest("javascript:alert('SHARE THIS Test');"), "_self");</p>
<p>	// this line sends it console.log<br />
	navigateToURL(new URLRequest("javascript:console.log('SHARE THIS Test to console.log');"), "_self");</p>
<p>}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2010/03/as3-button-to-javascript-alert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Timer</title>
		<link>http://jamesborder.com/2010/03/as3-timer/</link>
		<comments>http://jamesborder.com/2010/03/as3-timer/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 20:22:21 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=496</guid>
		<description><![CDATA[// new Timer([interval], [repeat]);
var myTimer:Timer = new Timer(2000, 1);
	myTimer.addEventListener(TimerEvent.TIMER, addDriverGrid);
	myTimer.start();
function addDriverGrid(event:TimerEvent):void {
	trace(&#8220;addDriverGrid()&#8221;);
}
]]></description>
			<content:encoded><![CDATA[<p>// new Timer([interval], [repeat]);<br />
var myTimer:Timer = new Timer(2000, 1);<br />
	myTimer.addEventListener(TimerEvent.TIMER, addDriverGrid);</p>
<p>	myTimer.start();</p>
<p>function addDriverGrid(event:TimerEvent):void {<br />
	trace(&#8220;addDriverGrid()&#8221;);<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2010/03/as3-timer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS-3 TextFieldAutoSize</title>
		<link>http://jamesborder.com/2010/02/as-3-textfieldautosize/</link>
		<comments>http://jamesborder.com/2010/02/as-3-textfieldautosize/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 06:39:42 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=474</guid>
		<description><![CDATA[label_txt.autoSize = TextFieldAutoSize.NONE — The default. No resizing.
label_txt.autoSize = TextFieldAutoSize.LEFT — Will automatically resize the textfield and left-align the text.
label_txt.autoSize = TextFieldAutoSize.CENTER — Will automatically resize the textfield and center the text.
label_txt.autoSize = TextFieldAutoSize.RIGHT — Will automatically resize the textfield and right-align the text.
]]></description>
			<content:encoded><![CDATA[<p>label_txt.autoSize = TextFieldAutoSize.NONE — The default. No resizing.</p>
<p>label_txt.autoSize = TextFieldAutoSize.LEFT — Will automatically resize the textfield and left-align the text.</p>
<p>label_txt.autoSize = TextFieldAutoSize.CENTER — Will automatically resize the textfield and center the text.</p>
<p>label_txt.autoSize = TextFieldAutoSize.RIGHT — Will automatically resize the textfield and right-align the text.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2010/02/as-3-textfieldautosize/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Manipulating volume</title>
		<link>http://jamesborder.com/2009/12/as3-manipulating-volume/</link>
		<comments>http://jamesborder.com/2009/12/as3-manipulating-volume/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 05:47:02 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=296</guid>
		<description><![CDATA[Tween out the volume of a netStream object:
Tweens the volume down to 0 over 1 second
var sndTransform		= new SoundTransform();
nsStream.soundTransform	= sndTransform;
TweenMax.to( nsStream, 1, { volume:0 });

needs TweenMax classes imported:
	import com.greensock.*;
	import com.greensock.easing.*;
]]></description>
			<content:encoded><![CDATA[<p>Tween out the volume of a netStream object:</p>
<p><code>Tweens the volume down to 0 over 1 second<br />
var sndTransform		= new SoundTransform();<br />
nsStream.soundTransform	= sndTransform;<br />
TweenMax.to( nsStream, 1, { volume:0 });<br />
</code><br />
needs TweenMax classes imported:</p>
<p>	import com.greensock.*;<br />
	import com.greensock.easing.*;</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/12/as3-manipulating-volume/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 &#8211; change movie clip color</title>
		<link>http://jamesborder.com/2009/11/as3-change-movie-clip-color/</link>
		<comments>http://jamesborder.com/2009/11/as3-change-movie-clip-color/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 02:23:34 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=301</guid>
		<description><![CDATA[
import fl.motion.Color;
var rmColorTransform:Color;
var bgColorTransform:Color;
function highlight_pad(mc):void {
	bgColorTransform = new Color();
	bgColorTransform.setTint(0x666666, 1); //alpha is second parameter
	mc.transform.colorTransform = bgColorTransform;
}
function clear_pad(mc):void {
	rmColorTransform = new Color();
	rmColorTransform.setTint(0xFF0000 , 0); //alpha is second parameter
	mc.transform.colorTransform = rmColorTransform;
}
]]></description>
			<content:encoded><![CDATA[<p><code><br />
import fl.motion.Color;</p>
<p>var rmColorTransform:Color;<br />
var bgColorTransform:Color;</p>
<p>function highlight_pad(mc):void {</p>
<p>	bgColorTransform = new Color();<br />
	bgColorTransform.setTint(0x666666, 1); //alpha is second parameter<br />
	mc.transform.colorTransform = bgColorTransform;</p>
<p>}</p>
<p>function clear_pad(mc):void {</p>
<p>	rmColorTransform = new Color();<br />
	rmColorTransform.setTint(0xFF0000 , 0); //alpha is second parameter<br />
	mc.transform.colorTransform = rmColorTransform;</p>
<p>}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/11/as3-change-movie-clip-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Smooth Loaded Bitmaps</title>
		<link>http://jamesborder.com/2009/10/as3-smooth-loaded-bitmaps/</link>
		<comments>http://jamesborder.com/2009/10/as3-smooth-loaded-bitmaps/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 05:23:34 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=287</guid>
		<description><![CDATA[//create a new loader object and put it on the stage
var slideLoader:Loader=new Loader();
this.addChild(slideLoader);
//load picture into loader object
slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, scaleContentForPicture);
slideLoader.load(new URLRequest(&#8220;images/tree.jpg&#8221;));
//smooth it once loaded
function scaleContentForPicture() {
var smoother_bm=Bitmap(slideLoader.content);
smoother_bm.smoothing=true;
}
]]></description>
			<content:encoded><![CDATA[<p>//create a new loader object and put it on the stage<br />
var slideLoader:Loader=new Loader();<br />
this.addChild(slideLoader);</p>
<p>//load picture into loader object<br />
slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, scaleContentForPicture);<br />
slideLoader.load(new URLRequest(&#8220;images/tree.jpg&#8221;));</p>
<p>//smooth it once loaded<br />
function scaleContentForPicture() {<br />
var smoother_bm=Bitmap(slideLoader.content);<br />
smoother_bm.smoothing=true;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/10/as3-smooth-loaded-bitmaps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 variables from a query string</title>
		<link>http://jamesborder.com/2009/06/actionscript-3-variables-from-a-query-string/</link>
		<comments>http://jamesborder.com/2009/06/actionscript-3-variables-from-a-query-string/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 16:46:10 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/site/actionscript_3_variables_from_a_query_string/#When:16:46:10Z</guid>
		<description><![CDATA[After using swfobject I thought I&#8217;d never have to pass variables to a swf thru the query string again&#8230;. oops.
Wrong&#8230;. and I had to look it up. I&#8217;m using a lightbox for a flv player and right now it looks like the easy way to make it happen is like this:
here is the lightbox call [...]]]></description>
			<content:encoded><![CDATA[<p>After using swfobject I thought I&#8217;d never have to pass variables to a swf thru the query string again&#8230;. oops.<br />
Wrong&#8230;. and I had to look it up. I&#8217;m using a lightbox for a flv player and right now it looks like the easy way to make it happen is like this:</p>
<p>here is the lightbox call (the only relevant part of this is the ?recordID=2)</p>
<p>&lt;a rel=&#8220;prettyPhoto[philosophy]&#8221; title=&#8220;Vid1&#8221; href=&#8221;/flash/XXXXXX.swf?recordID=2&#8221; rel=&#8220;prettyPhoto[philosophy]&#8221; title=&#8220;Description&#8221;>&lt;/a></p>
<p>here is the actionscript that gets it then assigns the piece I want:</p>
<p>var queryString = this.loaderInfo.parameters;<br />
var whichVideo =&nbsp; queryString.recordID;</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/06/actionscript-3-variables-from-a-query-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 custom starter class</title>
		<link>http://jamesborder.com/2009/05/actionscript-3-custom-starter-class/</link>
		<comments>http://jamesborder.com/2009/05/actionscript-3-custom-starter-class/#comments</comments>
		<pubDate>Sun, 31 May 2009 05:38:29 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/site/actionscript_3_custom_starter_class/#When:05:38:29Z</guid>
		<description><![CDATA[The class object adds an mouse event listener, that object is added to the stage five times and waits to get clicked
custom_class.zip
]]></description>
			<content:encoded><![CDATA[<p>The class object adds an mouse event listener, that object is added to the stage five times and waits to get clicked<br />
custom_class.zip</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/05/actionscript-3-custom-starter-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 random numbers</title>
		<link>http://jamesborder.com/2009/05/actionscript-3-random-numbers/</link>
		<comments>http://jamesborder.com/2009/05/actionscript-3-random-numbers/#comments</comments>
		<pubDate>Tue, 26 May 2009 04:52:37 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/site/actionscript_3_random_numbers/#When:04:52:37Z</guid>
		<description><![CDATA[//The number after the asterisk is the range from which the random number will come
//A random number between 1 and 100, since i&#8217;m using an int there will be no .whatever
var randomNumber:int = Math.random()*100;
trace(randomNumber);
/// with a range and I&#8217;m told with a better value distribution
var lowVal:int = 100;
var highVal:int = 201;
var randomNumber:int = ( Math.random() [...]]]></description>
			<content:encoded><![CDATA[<p>//The number after the asterisk is the range from which the random number will come<br />
//A random number between 1 and 100, since i&#8217;m using an int there will be no .whatever<br />
var randomNumber:int = Math.random()*100;<br />
trace(randomNumber);</p>
<p>/// with a range and I&#8217;m told with a better value distribution</p>
<p>var lowVal:int = 100;<br />
var highVal:int = 201;</p>
<p>var randomNumber:int = ( Math.random() * (1+highVal&#45;lowVal) ) + lowVal; </p>
<p>trace(randomNumber);</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/05/actionscript-3-random-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3 combo box onchange event</title>
		<link>http://jamesborder.com/2009/05/actionscript-3-combo-box-onchange-event/</link>
		<comments>http://jamesborder.com/2009/05/actionscript-3-combo-box-onchange-event/#comments</comments>
		<pubDate>Wed, 20 May 2009 20:08:03 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/site/actionscript_3_combo_box_onchange_event/#When:20:08:03Z</guid>
		<description><![CDATA[// import the class
import fl.data.DataProvider;
// create and load some data into the comboBox
// this one is already on the stage but you can also var myCBox:ComboBox = new ComboBox();  etc.
var dp:DataProvider = new DataProvider();
var sortFilters:Array = [ ["value 1", "Label 1"], ["value 2", "Label 2"], ["value 3", "Label 3"], ["value 4", "Label 4"],];
for (var [...]]]></description>
			<content:encoded><![CDATA[<p>// import the class<br />
import fl.data.DataProvider;</p>
<p>// create and load some data into the comboBox<br />
// this one is already on the stage but you can also var myCBox:ComboBox = new ComboBox();  etc.<br />
var dp:DataProvider = new DataProvider();<br />
var sortFilters:Array = [ ["value 1", "Label 1"], ["value 2", "Label 2"], ["value 3", "Label 3"], ["value 4", "Label 4"],];</p>
<p>for (var i:uint=0; i &lt; sortFilters.length; i++) {<br />
	dp.addItem( { label: sortFilters&#91;i][1], data:sortFilters&#91;i][0] } );<br />
}</p>
<p>myCBox.dataProvider = dp;</p>
<p>// add the listener<br />
myCBox.addEventListener(Event.CHANGE, changeHandler); </p>
<p>function changeHandler(event:Event):void {<br />
	whateverYouWantToHappen();<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2009/05/actionscript-3-combo-box-onchange-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
