<?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>Blowing Through Lines &#187; Flash AS 3.0</title>
	<atom:link href="http://blowingthroughlines.com/category/flash-as-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blowingthroughlines.com</link>
	<description>Highly addictive code.</description>
	<lastBuildDate>Tue, 15 Jun 2010 18:14:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tabs and Linefeeds (Newlines) in XML driven TextFields</title>
		<link>http://blowingthroughlines.com/2009/12/13/flash-as-3/tabs-and-linefeeds-newlines-in-xml-driven-textfields/</link>
		<comments>http://blowingthroughlines.com/2009/12/13/flash-as-3/tabs-and-linefeeds-newlines-in-xml-driven-textfields/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 04:37:19 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=208</guid>
		<description><![CDATA[Man Flash can be annoying sometimes. So I&#8217;m showing some settings as a list, like
Item: value1
Item Two: value2
Item Three: value3

And the client asks if we can align the values vertically, and thinking like a programmer who likes to keep his code clean I&#8217;m thinking &#171;Sure, that shouldn&#8217;t be a problem, I&#8217;ll just add some \t&#8217;s [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Man Flash can be annoying sometimes. So I&#8217;m showing some settings as a list, like<br />
<code>Item: value1<br />
Item Two: value2<br />
Item Three: value3<br />
</code></p>
<p>And the client asks if we can align the values vertically, and thinking like a programmer who likes to keep his code clean I&#8217;m thinking &laquo;Sure, that shouldn&#8217;t be a problem, I&#8217;ll just add some <code>\t</code>&#8217;s to the XML file and we should be all set,&raquo; but all that comes out is, &ldquo;Sure, should only take a few minutes to add.&rdquo;</p>
<p>So I add some <code>\t</code>&#8217;s to the XML and what does flash do with them, it prints out all literal backslashes and ts.</p>
<p>SO then what? Well I was being lazy and specifying <code>xml.node</code> not <code>xml.node.text()</code> to get the text values. Switching it does nothing. So then I start tracing things and looking around the Goog. Finally it becomes apparent that Flash is urlencoding the XML text in the background when processing it, and when it urldecodes it, some things are kept that shouldn&#8217;t be, like all escaped string characters that would normally not print.</p>
<p>Oh yeah, condenseWhite was false.</p>
<p>So I start with just doing a simple replace(/\\t/g, &#8220;!!!!&#8221;) to find out if I can even find the damn things, and I get no exclamation marks&hellip; or dirty words. Then a forum entry that was so buried I haven&#8217;t even found it again to link to, suggested using unescape(xml.node.text()) for a close, but ultimately unrelated problem.</p>
<p>To make a long story short here&#8217;s the solution:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p208code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2082"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p208code2"><pre class="actionscript" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">var</span> tabs:RegExp = <span style="color: #66cc66;">/</span>\\t<span style="color: #66cc66;">/</span>g;
	<span style="color: #000000; font-weight: bold;">var</span> newlines:RegExp = <span style="color: #66cc66;">/</span>\\n<span style="color: #66cc66;">/</span>g;
	txt.<span style="color: #0066CC;">htmlText</span> = <span style="color: #0066CC;">unescape</span><span style="color: #66cc66;">&#40;</span>wagerText<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span>tabs, <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span>newlines, <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Go figure right?</p>
<p>As always if anyone has a better solution I&#8217;m all ears, or at least all comment-reading&hellip; eventually.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2009/12/13/flash-as-3/tabs-and-linefeeds-newlines-in-xml-driven-textfields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>External Interface Callbacks with Jquery</title>
		<link>http://blowingthroughlines.com/2009/09/28/bugs/external-interface-callbacks-with-jquery/</link>
		<comments>http://blowingthroughlines.com/2009/09/28/bugs/external-interface-callbacks-with-jquery/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 15:59:07 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=141</guid>
		<description><![CDATA[So first off, NEVER use this most lazy of hacks to reference the flash object when calling a method in a flash file:

?View Code JAVASCRIPT1
2
3
4
// some code
function test&#40;&#41; &#123;
	flashID.ner&#40;&#34;hello&#34;&#41;; // BAAAAAAD!
&#125;

For some reason it works… Some of the time. On Safari when testing running from Flex. On my Mac.
I was being lazy and not really [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>So first off, <em><strong>NEVER</strong></em> use this most lazy of hacks to reference the flash object when calling a method in a flash file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p141code6'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1416"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p141code6"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// some code</span>
<span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	flashID.<span style="color: #660066;">ner</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hello&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// BAAAAAAD!</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>For some reason it works… Some of the time. On Safari when testing running from Flex. On my Mac.</p>
<p>I was being lazy and not really thinking back to how things work in Javascript at the time, then having recently started using Jquery, I tried:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p141code7'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1417"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p141code7"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// some code</span>
<span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> flashMovie <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#flashID'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	flashMovie.<span style="color: #660066;">ner</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hello&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// ALSO BAAAAAAD!</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Also doesn&#8217;t work, for some reason Jquery removes the methods associated with the embed tag that is written, and replaces them with only the Jquery methods. So in order for this to work the code needs to be simply:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p141code8'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1418"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p141code8"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> flashMovie <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementByID</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;flashID&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	flashMovie.<span style="color: #660066;">ner</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hello&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// FINALLY! It worked.</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>



<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2009/09/28/bugs/external-interface-callbacks-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box2D Shortcuts (Round 1)</title>
		<link>http://blowingthroughlines.com/2009/07/14/flash-as-3/box2d-shortcuts-round-1/</link>
		<comments>http://blowingthroughlines.com/2009/07/14/flash-as-3/box2d-shortcuts-round-1/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 18:02:35 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[wrapper]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=159</guid>
		<description><![CDATA[Since leaving Hunt &#038; Gather, I&#8217;ve been (besides relishing the peace and quiet a bit) playing around with some of those Flash libraries I hadn&#8217;t had time for. Most tantalizing of which is the Box2D library. I&#8217;d attempted to use it for this auto layout class for LDa Architects, but because of time constraints ended [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Since leaving Hunt &#038; Gather, I&#8217;ve been (besides relishing the peace and quiet a bit) playing around with some of those Flash libraries I hadn&#8217;t had time for. Most tantalizing of which is the Box2D library. I&#8217;d attempted to use it for this auto layout class for <a href="http://www.lda-architects.com/#/outsidelda/section=news" target="_blank">LDa Architects</a>, but because of time constraints ended up settling for <a href="http://www.cove.org/ape/" target="_blank">APE</a> which as you can see is a bit out of date at this point. Anyway APE is fine if the number of bodies is small and you only need very basic simulation capabilities (boxes don&#8217;t rotate unless they are attached to 2 or more wheels for instance&#8230;), but once you wanna do more advanced things, like robots or buoyancy you&#8217;ll need a faster more complete engine. </p>
<p>Box2D seems to be the fastest and most current option out there, but it&#8217;s got kind of a funky API due in part to being a fairly direct port from C++. The complicated setup is in fact what had kept me from using it for so long, but some better documentation and turorial files available on the <a href="http://www.box2d.org/wiki/index.php?title=Manual/AS3" target="_blank">Box2D Wiki</a> is making getting started easier. And to make things even simpler to play with, I&#8217;m creating a series of wrapper classes that reduce the amount of code needed to get things started.</p>
<h3>World.world</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p159code11'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p15911"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
</pre></td><td class="code" id="p159code11"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">paperclipped</span>.<span style="color: #006600;">physics</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2AABB</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2DebugDraw</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/**
	 * This is a container class to make the creation of Box2D World simpler.
	 * Box2D r47 or greater required.
	 * (c) 2009 Collin Reisdorf MIT License
	 * 
	 * @author Collin Reisodrf
	 */</span>	
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> World
	<span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">//-----------------------------------------Variables-----------------------------------------//</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _scale:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _world:b2World;
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//------------------------------------------Getters------------------------------------------//</span>
		<span style="color: #808080; font-style: italic;">/**
		 * @return Scale set by the user when the world is constructed.
		 */</span>				
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> scale<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>		<span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _scale;	<span style="color: #66cc66;">&#125;</span>
		<span style="color: #808080; font-style: italic;">/**
		 * @return The world object made by the constructor.
		 */</span>		
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> world<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:b2World		<span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _world;	<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//----------------------------------------Constructor----------------------------------------//		</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> World<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span>:uint, <span style="color: #0066CC;">height</span>:uint, debugSprite:Sprite=<span style="color: #000000; font-weight: bold;">null</span>, showCenterOfMass:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">false</span>, gravity:b2Vec2=<span style="color: #000000; font-weight: bold;">null</span>, scale:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">30</span>, padding:uint=<span style="color: #cc66cc;">1000</span>, doSleep:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> worldAABB:b2AABB = <span style="color: #000000; font-weight: bold;">new</span> b2AABB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				worldAABB.<span style="color: #006600;">lowerBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-padding, -padding<span style="color: #66cc66;">&#41;</span>;
				worldAABB.<span style="color: #006600;">upperBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span>+padding, <span style="color: #0066CC;">width</span>+padding<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			gravity = <span style="color: #66cc66;">&#40;</span>gravity<span style="color: #66cc66;">&#41;</span>? gravity:<span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">10.0</span><span style="color: #66cc66;">&#41;</span>;
			_world = <span style="color: #000000; font-weight: bold;">new</span> b2World<span style="color: #66cc66;">&#40;</span>worldAABB, gravity, doSleep<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>debugSprite<span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span>	debugDraw:b2DebugDraw = <span style="color: #000000; font-weight: bold;">new</span> b2DebugDraw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
					debugDraw.<span style="color: #006600;">SetSprite</span><span style="color: #66cc66;">&#40;</span>debugSprite<span style="color: #66cc66;">&#41;</span>;
					debugDraw.<span style="color: #006600;">SetDrawScale</span><span style="color: #66cc66;">&#40;</span>scale<span style="color: #66cc66;">&#41;</span>;
					debugDraw.<span style="color: #006600;">SetFillAlpha</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.3</span><span style="color: #66cc66;">&#41;</span>;
					debugDraw.<span style="color: #006600;">SetLineThickness</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span>;
					debugDraw.<span style="color: #006600;">SetFlags</span><span style="color: #66cc66;">&#40;</span>b2DebugDraw.<span style="color: #006600;">e_shapeBit</span> <span style="color: #66cc66;">|</span> b2DebugDraw.<span style="color: #006600;">e_jointBit</span> <span style="color: #66cc66;">|</span> uint<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>showCenterOfMass<span style="color: #66cc66;">&#41;</span>? b2DebugDraw.<span style="color: #006600;">e_centerOfMassBit</span>:<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				_world.<span style="color: #006600;">SetDebugDraw</span><span style="color: #66cc66;">&#40;</span>debugDraw<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//--------------------------------------Private Methods--------------------------------------//</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//--------------------------------------Public  Methods--------------------------------------//</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h3>Chain</h3>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p159code12'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p15912"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
</pre></td><td class="code" id="p159code12"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">paperclipped</span>.<span style="color: #006600;">physics</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Joints</span>.<span style="color: #006600;">b2Joint</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Joints</span>.<span style="color: #006600;">b2RevoluteJointDef</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;
	<span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/**
	 * This is a container class to make the creation of a chain simpler
	 * Box2D r47 or greater required.
	 * (c) 2009 Collin Reisdorf MIT License
	 * 
	 * @author Collin Reisodrf
	 */</span>	
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Chain
	<span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">//-----------------------------------------Variables-----------------------------------------//</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const HORIZONTAL:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'h'</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const VERTICAL:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'v'</span>; <span style="color: #808080; font-style: italic;">// not supported yet</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bodies:<span style="color: #0066CC;">Array</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _joints:<span style="color: #0066CC;">Array</span>;
<span style="color: #808080; font-style: italic;">//		private var _parent:</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _world:b2World;
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//------------------------------------------Getters------------------------------------------//</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> bodies<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span> 	<span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _bodies;								<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:b2Body 	<span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _bodies<span style="color: #66cc66;">&#91;</span>_bodies.<span style="color: #006600;">length</span>-<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> as b2Body;	<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> joints<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>	<span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _joints;								<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:b2Body	<span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _bodies<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> as b2Body;					<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//------------------------------------------Setters------------------------------------------//</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//----------------------------------------Constructor----------------------------------------//</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Chain<span style="color: #66cc66;">&#40;</span>world:b2World, numLinks:uint=<span style="color: #cc66cc;">3</span>, anchorX:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>, anchorY:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>, direction:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;h&quot;</span>, swingLimit:uint=<span style="color: #cc66cc;">0</span>, <span style="color: #808080; font-style: italic;">/*parent=null,*/</span> scale:uint=<span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			_world = world;
			_bodies = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_joints = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//			_parent = parent; // not sure what/how to attach this to yet...</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> ground:b2Body = world.<span style="color: #006600;">GetGroundBody</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>;
			<span style="color: #000000; font-weight: bold;">var</span> anchor:b2Vec2 = <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> body:b2Body;
			<span style="color: #000000; font-weight: bold;">var</span> joint:b2Joint;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> sd:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			sd.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">24</span> <span style="color: #66cc66;">/</span> scale, <span style="color: #cc66cc;">5</span> <span style="color: #66cc66;">/</span> scale<span style="color: #66cc66;">&#41;</span>;
			sd.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;">100.0</span>;
			sd.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;">0.8</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> bd:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> jd:b2RevoluteJointDef = <span style="color: #000000; font-weight: bold;">new</span> b2RevoluteJointDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>swingLimit <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				jd.<span style="color: #006600;">lowerAngle</span> = -swingLimit <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">180</span><span style="color: #66cc66;">/</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span><span style="color: #66cc66;">&#41;</span>;
				jd.<span style="color: #006600;">upperAngle</span> = swingLimit <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">180</span><span style="color: #66cc66;">/</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span><span style="color: #66cc66;">&#41;</span>;
				jd.<span style="color: #006600;">enableLimit</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span>
			<span style="color: #66cc66;">&#123;</span>
				jd.<span style="color: #006600;">enableLimit</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> prevBody:b2Body = ground;
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>i = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">3</span>; ++i<span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">//				if(i == 0)</span>
<span style="color: #808080; font-style: italic;">//				{</span>
<span style="color: #808080; font-style: italic;">//				trace(&quot;enabled motor damnit&quot;);</span>
<span style="color: #808080; font-style: italic;">//					jd.enableMotor = true;</span>
<span style="color: #808080; font-style: italic;">//					jd.motorSpeed = 1;</span>
<span style="color: #808080; font-style: italic;">//					jd.maxMotorTorque = 100;</span>
<span style="color: #808080; font-style: italic;">//				}else</span>
<span style="color: #808080; font-style: italic;">//				{</span>
<span style="color: #808080; font-style: italic;">//					jd.enableMotor = false;</span>
<span style="color: #808080; font-style: italic;">//</span>
<span style="color: #808080; font-style: italic;">//				}</span>
&nbsp;
				bd.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>anchorX + <span style="color: #cc66cc;">22</span> + <span style="color: #cc66cc;">44</span> <span style="color: #66cc66;">*</span> i<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> scale, anchorY <span style="color: #66cc66;">/</span> scale<span style="color: #66cc66;">&#41;</span>;
				body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>bd<span style="color: #66cc66;">&#41;</span>;
				body.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>sd<span style="color: #66cc66;">&#41;</span>;
				body.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				anchor.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>anchorX + <span style="color: #cc66cc;">44</span> <span style="color: #66cc66;">*</span> i<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> scale, anchorY <span style="color: #66cc66;">/</span> scale<span style="color: #66cc66;">&#41;</span>;
				jd.<span style="color: #006600;">Initialize</span><span style="color: #66cc66;">&#40;</span>prevBody, body, anchor<span style="color: #66cc66;">&#41;</span>;
				joint = world.<span style="color: #006600;">CreateJoint</span><span style="color: #66cc66;">&#40;</span>jd<span style="color: #66cc66;">&#41;</span>;
&nbsp;
				prevBody = body;
				_bodies.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>body<span style="color: #66cc66;">&#41;</span>;
				_joints.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>joint<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//--------------------------------------Private Methods--------------------------------------//</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//--------------------------------------Public  Methods--------------------------------------//</span>
<span style="color: #808080; font-style: italic;">//-------------------------------------------------------------------------------------------//</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Keep an eye out for more, I&#8217;m working on robot leg linkages next. And also trying to get a new job <img src='http://blowingthroughlines.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2009/07/14/flash-as-3/box2d-shortcuts-round-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWFAddress, if You Aren&#8217;t Using it for All Your Flash, Start to</title>
		<link>http://blowingthroughlines.com/2009/04/03/javascript/swfaddress-if-you-arent-using-it-for-all-your-flash-start-to/</link>
		<comments>http://blowingthroughlines.com/2009/04/03/javascript/swfaddress-if-you-arent-using-it-for-all-your-flash-start-to/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 16:30:39 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=129</guid>
		<description><![CDATA[We&#8217;ve been using SWFAddress for a while now, and while I was cleaning old project files out of Flex I came across my first Flex Test using it. It&#8217;s simple, and in fact, SWFAddress has been improved a bunch since this test was made (mostly involving SEO, and fallback links + Google Analytics). Now we&#8217;re [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using <a href="http://www.asual.com/swfaddress/" title="SWFAddress project homepage">SWFAddress</a> for a while now, and while I was cleaning old project files out of Flex I came across my first Flex Test using it. It&#8217;s simple, and in fact, SWFAddress has been improved a bunch since this test was made (mostly involving SEO, and fallback links + Google Analytics). Now we&#8217;re using it for running our entire navigation schemes for all Flash sites, mini-sites, components, and even in our pitches.</p>
<p>Check out my <a href="/examples/SWFAddressTester/" title="SWFAddress Example (click to set address to future X location of the black box">example (click anywhere to move the box, then use the back/forward buttons for undo/redo).</a></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p129code14'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12914"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
</pre></td><td class="code" id="p129code14"><pre class="actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">asual</span>.<span style="color: #006600;">swfaddress</span>.<span style="color: #006600;">SWFAddress</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">asual</span>.<span style="color: #006600;">swfaddress</span>.<span style="color: #006600;">SWFAddressEvent</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Shape</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;">events</span>.<span style="color: #006600;">MouseEvent</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SWFAddress_test <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _square:Shape;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SWFAddress_test<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			SWFAddress.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SWFAddressEvent.<span style="color: #006600;">INIT</span>, init<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> init<span style="color: #66cc66;">&#40;</span>evt:SWFAddressEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			SWFAddress.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>SWFAddressEvent.<span style="color: #006600;">CHANGE</span>, handleSWFAddressChange<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, gotoAddress<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_square = <span style="color: #000000; font-weight: bold;">new</span> Shape<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_square.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x0<span style="color: #66cc66;">&#41;</span>;
			_square.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">50</span>,<span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>_square<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> handleSWFAddressChange<span style="color: #66cc66;">&#40;</span>evt:SWFAddressEvent<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>evt.<span style="color: #006600;">path</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> address:<span style="color: #0066CC;">Array</span> = evt.<span style="color: #006600;">path</span>.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/&quot;</span>, <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> xLoc:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>address<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #0066CC;">isNaN</span><span style="color: #66cc66;">&#40;</span>xLoc<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> moveSquare<span style="color: #66cc66;">&#40;</span>xLoc<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> gotoAddress<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			SWFAddress.<span style="color: #006600;">setValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">mouseX</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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> moveSquare<span style="color: #66cc66;">&#40;</span>loc:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_square.<span style="color: #006600;">x</span> = loc;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>



<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2009/04/03/javascript/swfaddress-if-you-arent-using-it-for-all-your-flash-start-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Custom Validator Email Confirmation</title>
		<link>http://blowingthroughlines.com/2009/02/18/uncategorized/flex-custom-validator-email-confirmation/</link>
		<comments>http://blowingthroughlines.com/2009/02/18/uncategorized/flex-custom-validator-email-confirmation/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 18:18:16 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[flex3]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=100</guid>
		<description><![CDATA[Pretty simple stuff.  This was driving me a bit crazy at the beginning of the day so I decided to just cut and paste my source code hoping this will help someone else out.  Basically I just want to create a custom validator that makes sure one field is equal to another in [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Pretty simple stuff.  This was driving me a bit crazy at the beginning of the day so I decided to just cut and paste my source code hoping this will help someone else out.  Basically I just want to create a custom validator that makes sure one field is equal to another in flex.  Pretty simple but if you are a noob you will find this task a bit sucky&#8230;.  Her is the code</p>
<p>Actionscript Custom Validator.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p100code17'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10017"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code" id="p100code17"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">flextradeshow</span>.<span style="color: #006600;">classes</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">TextInput</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">validators</span>.<span style="color: #006600;">ValidationResult</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">validators</span>.<span style="color: #006600;">Validator</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EqualValidator <span style="color: #0066CC;">extends</span> Validator
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> results:<span style="color: #0066CC;">Array</span>;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> textbox:TextInput = <span style="color: #000000; font-weight: bold;">new</span> TextInput<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> EqualValidator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
		override protected <span style="color: #000000; font-weight: bold;">function</span> doValidation<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>
		<span style="color: #66cc66;">&#123;</span>
			results = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
			results = <span style="color: #0066CC;">super</span>.<span style="color: #006600;">doValidation</span><span style="color: #66cc66;">&#40;</span>value<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>results.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">return</span> results;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>value<span style="color: #66cc66;">!</span>=textbox.<span style="color: #0066CC;">text</span> <span style="color: #66cc66;">||</span> <span style="color: #66cc66;">!</span>value<span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				results.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ValidationResult<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span>,<span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #ff0000;">&quot;NaN&quot;</span>,<span style="color: #ff0000;">&quot;Not a matching value sorry&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">return</span> results;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> results;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>This is the code you need in your view to use the validator.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p100code18'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10018"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code" id="p100code18"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Panel</span> <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <span style="color: #000066;">xmlns:tsclasses</span>=<span style="color: #ff0000;">&quot;com.flextradeshow.classes.*&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:StringValidator</span></span>
<span style="color: #009900;">		<span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;nameValidator&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;{_iname}&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;text&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">minLength</span>=<span style="color: #ff0000;">&quot;4&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:EmailValidator</span></span>
<span style="color: #009900;">		<span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;emailValidator&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;{_iemail}&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;text&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:EmailValidator</span></span>
<span style="color: #009900;">		<span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;emailConfirmationValidator&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;{_iconfirmemail}&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;text&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tsclasses:EqualValidator</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;sameEmailValidator&quot;</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;{_iconfirmemail}&quot;</span> <span style="color: #000066;">textbox</span>=<span style="color: #ff0000;">&quot;{_iemail}&quot;</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Form</span> <span style="color: #000066;">labelWidth</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;302&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">horizontalScrollPolicy</span>=<span style="color: #ff0000;">&quot;off&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:FormItem</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Full Name&quot;</span> <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:TextInput</span>  <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;_iname&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:FormItem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:FormItem</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Email&quot;</span> <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:TextInput</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;_iemail&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:FormItem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:FormItem</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Confirm Email&quot;</span> <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:TextInput</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;_iconfirmemail&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:FormItem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:FormItem</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Birthday&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:DateField</span>  <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;_ibirthday&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:FormItem<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Spacer</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;15&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Label</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;Free mimoDesk Sample (Choose One)&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/mx:Label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Box</span> <span style="color: #000066;">paddingLeft</span>=<span style="color: #ff0000;">&quot;110&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:RadioButtonGroup</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;freemimodesk&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:RadioButton</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Star Wars&quot;</span> <span style="color: #000066;">groupName</span>=<span style="color: #ff0000;">&quot;freemimodesk&quot;</span> <span style="color: #000066;">selected</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:RadioButton</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Tokidoki&quot;</span> <span style="color: #000066;">groupName</span>=<span style="color: #ff0000;">&quot;freemimodesk&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:RadioButton</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Original Core Series&quot;</span> <span style="color: #000066;">groupName</span>=<span style="color: #ff0000;">&quot;freemimodesk&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:RadioButton</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Not Interested&quot;</span> <span style="color: #000066;">groupName</span>=<span style="color: #ff0000;">&quot;freemimodesk&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Box<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Spacer</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;15&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Label</span> <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;Subscribe to any of the following Newsletters&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/mx:Label<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Box</span> <span style="color: #000066;">paddingLeft</span>=<span style="color: #ff0000;">&quot;110&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:CheckBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Consumer&quot;</span> <span style="color: #000066;">selected</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:CheckBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Press&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:CheckBox</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Wholesale&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Box<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Box</span> <span style="color: #000066;">horizontalAlign</span>=<span style="color: #ff0000;">&quot;right&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Button</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Subscribe&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Box<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>



<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2009/02/18/uncategorized/flex-custom-validator-email-confirmation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Look for Actionscript (and most other c-like source-code)</title>
		<link>http://blowingthroughlines.com/2008/10/04/flash-as-3/quick-look-for-actionscript-and-most-other-c-like-source-code/</link>
		<comments>http://blowingthroughlines.com/2008/10/04/flash-as-3/quick-look-for-actionscript-and-most-other-c-like-source-code/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 20:51:09 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[hints]]></category>
		<category><![CDATA[as]]></category>
		<category><![CDATA[util]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=85</guid>
		<description><![CDATA[Stumbled across this Quick Look plugin the other day while learning Objective-C, and while it previewed and code colored my .h and .m files, it was a bit disappointing that it didn&#8217;t work on .as files.
So not quite as simple as adding .as to the info.plist&#8212;what I&#8217;ve done is add public.archive.applesingle to the list of [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Stumbled across this Quick Look plugin the other day while learning Objective-C, and while it previewed and code colored my .h and .m files, it was a bit disappointing that it didn&#8217;t work on .as files.</p>
<p>So not quite as simple as adding .as to the info.plist&mdash;what I&#8217;ve done is add public.archive.applesingle to the list of UTI types. This is a bit of a hack, because Adobe doesn&#8217;t export a profile UTI with .as files. So if they do start doing that someday, this may cause problems, but in the meantime, it&#8217;s the simplest way to get quicklook working for .as files.</p>
<p><a href='http://blowingthroughlines.com/wp-content/uploads/2008/10/qlenscript_with_as.zip' title='quicklook as plugin'>Download Quick Look with ActionScript Plugin</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/10/04/flash-as-3/quick-look-for-actionscript-and-most-other-c-like-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FIVe3D Rocks, but name is hard to type fast&#8230;</title>
		<link>http://blowingthroughlines.com/2008/08/03/flash-as-3/five3d-rocks/</link>
		<comments>http://blowingthroughlines.com/2008/08/03/flash-as-3/five3d-rocks/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 17:52:12 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=53</guid>
		<description><![CDATA[I don&#8217;t know where the capitalization came from, but it&#8217;s such a simple API for anyone who&#8217;s happy with AS3 (is there anyone who isn&#8217;t?) that FIVe3D worth the challenging finger-work. I made this demo in about 3 hours total, it draws bitmaps, and adds them to Sprite3Ds, and mimicks what we&#8217;ve been working on [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know where the capitalization came from, but it&#8217;s such a simple API for anyone who&#8217;s happy with AS3 (is there anyone who isn&#8217;t?) that <a href="http://five3d.mathieu-badimon.com/" target="_blank" title="Kick-assingly simple 3D in Flash">FIVe3D</a> worth the challenging finger-work. I made this demo in about 3 hours total, it draws bitmaps, and adds them to Sprite3Ds, and mimicks what we&#8217;ve been working on for 2 months in <a href="http://blog.papervision3d.org" target="_blank" title="Kick-assingly complicated 3D in Flash">Papervision3D</a> (I&#8217;ll definitly have a link to that when its fully launched).</p>
<p>For a great many simpler 3D applications, I think FIVe3D is the way-to-go, but Papervision3D still does have an edge in speed (when properly optimized that is) if dealing with more then 20 or so planes.</p>
<p>One quirk of FIVe3D that I initially didn&#8217;t get, was that the order of my addChild statements determines what shows up on top of what, <em>not</em> the Z value of the sprite, so included with this source is a handy depth sorter loop, that will work with any 53D setup.</p>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/08/five3dtest.swf" width="100%" height="500" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/08/five3dtest.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object><br />
<a href='http://blowingthroughlines.com/wp-content/uploads/2008/08/five3dtest.zip'>FIVe3D Test Source</a></p>
<p>Also modified it a little so that height and width could be stored in the sprite3D class, i know bad me, but until i get my head around Mathieu&#8217;s version of Matrix3D. That ugly blinking plane on the right side is actually a series of bitmapDatas, that are playing back (like cached animation) that I learned from <a href="http://www.rockonflash.com/blog/" target="_blank">John Grden</a> a few weeks ago. I&#8217;m working on my own version of a class to automatically create bmp animations from a timeline swf, unless his goes open source&hellip;</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/08/03/flash-as-3/five3d-rocks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Some Flash Spring Physics</title>
		<link>http://blowingthroughlines.com/2008/08/03/flash-as-3/some-flash-spring-physics/</link>
		<comments>http://blowingthroughlines.com/2008/08/03/flash-as-3/some-flash-spring-physics/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 16:45:14 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[nodes]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[springy]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/?p=43</guid>
		<description><![CDATA[Finally had an excuse to make some connected springs, ala the Visual Thesaurus. This was the last of the tests before realizing that the project would be simpler.
(Please open the article to see the flash file or player.)
Double-click a dot to add a child dot, or click and drag any dot to move it.
Some code [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Finally had an excuse to make some connected springs, ala the <a href="http://www.visualthesaurus.com/" target="_blank" title="what I ripped off, but in Flash">Visual Thesaurus</a>. This was the last of the tests before realizing that the project would be simpler.</p>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/08/tethering.swf" width="100%" height="500" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/08/tethering.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<h6>Double-click a dot to add a child dot, or click and drag any dot to move it.</h6>
<p><del datetime="2009-04-01T18:26:12+00:00">Some code will be on the way in a bit.</del></p>
<h3>Update</h3>
<p class="postmetadata">Last edited by nilloc on Wednesday, April 1, 2009</p>
<p>Oh yeah, this is kinda late (my how the last 7 months flew by), but here&#8217;s the actual project in action:<br />
<a href="http://www.fuse.tv/ontv/shows/lil-wayne/" target="_blank">Lil&#8217; Wayne&#8217;s World</a></p>
<p>Oh yeah and here&#8217;s the source for the simple spring example above (AS2):<br />
<a href='http://blowingthroughlines.com/wp-content/uploads/2008/08/blowingthroughlinescom_spring_physics.zip'>blowingthroughlinescom_spring_physics</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/08/03/flash-as-3/some-flash-spring-physics/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automatic Bending Joints in As3 (Simple Bones)</title>
		<link>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/</link>
		<comments>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 22:32:40 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2008/02/10/flash-as3/automatic-bending-joints-in-as3-simple-bones/</guid>
		<description><![CDATA[This was part of a Rock&#8217;em Sock&#8217;em Robot game&#038; 8212;for an internal sales project no less! At any rate the budget was good, but the timeline was a little tight, and I was still getting my head around AS3 and the new Flash 9 features.
So I had this idea:
I&#8217;m working with a bunch of designer&#8217;s [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This was part of a Rock&#8217;em Sock&#8217;em Robot game&#038; 8212;for an internal sales project no less! At any rate the budget was good, but the timeline was a little tight, and I was still getting my head around AS3 and the new Flash 9 features.</p>
<h3>So I had this idea:</h3>
<p>I&#8217;m working with a bunch of designer&#8217;s who are really good with illustrator, and keyframe animating, but don&#8217;t have the time to animate all the movements (each head, body, upper arm x2 lower arm x2, legs, hands, feet&#8230; well you get the idea). So I needed a way to reduce the number of animations that the designers would be needed for, but also not create too many Tweeners or other hard coded animation solutions. I really needed <a href="http://aralbalkan.com/1072" target="_blank" title="Animated IK (bones) in Diesel (Flash CS4)">bones</a>, but those don&#8217;t seem to be arriving for a while, so the next best thing was automatically animated elbows (and knees). Fortunately for me the illustrator I was working with designed the robot&#8217;s arms and legs with even length upper and lower lengths so I could do some trig and get this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p35code20'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3520"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p35code20"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> theta:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">acos</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>distance<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span>limbL<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">180</span><span style="color: #66cc66;">/</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">limb</span>.<span style="color: #006600;">rotation</span> =  baseRotation - theta;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">omoLimb</span>.<span style="color: #006600;">rotation</span> = theta <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;</pre></td></tr></table></div>

<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/02/joint_test4.swf" width="500" height="400" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/02/joint_test4.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object><br />
<span class="caption">Click and drag the hand or foot to see the automagic joint rotation</span></p>
<p><a href='http://blowingthroughlines.com/wp-content/uploads/2008/02/blowingthroughlines_joint.zip' title='AS3 Joint class source'>AS3 Joint class source file</a></p>
<p>Right now it&#8217;s limited to even length bones, but my little brother with the physics and math degrees, says he has a better equation, so as soon as I have time I&#8217;ll update the classes. A public SVN repository is in the works too, stay tuned.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accordion Meets XML</title>
		<link>http://blowingthroughlines.com/2008/01/27/cs3/accordion-meets-xml/</link>
		<comments>http://blowingthroughlines.com/2008/01/27/cs3/accordion-meets-xml/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 06:53:40 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2008/01/27/flash-as3/accordion-meets-xml/</guid>
		<description><![CDATA[So a reader asked how to implement our accordion script using XML to populate it, and I think the results aren&#8217;t half bad. I&#8217;m not sure what he meant by a cervical shaped accordion though&#8230; Circular maybe? hopefully?
(Please open the article to see the flash file or player.)
source files for the xml&#8217;d accordion

?View Code ACTIONSCRIPTprivate [...]


Related posts:<ol><li><a href='http://blowingthroughlines.com/2009/12/13/flash-as-3/tabs-and-linefeeds-newlines-in-xml-driven-textfields/' rel='bookmark' title='Permanent Link: Tabs and Linefeeds (Newlines) in XML driven TextFields'>Tabs and Linefeeds (Newlines) in XML driven TextFields</a> <small>Man Flash can be annoying sometimes. So I&#8217;m showing some...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>So a reader asked how to implement <a href="http://blowingthroughlines.com/2007/09/17/flash-as3/accordion-component-as3-flash-9/">our accordion script</a> using XML to populate it, and I think the results aren&#8217;t half bad. I&#8217;m not sure what he meant by a <em>cervical</em> shaped accordion though&#8230; Circular maybe? hopefully?</p>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/01/accordionxml.swf" width="500" height="400" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/01/accordionxml.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p><a href='http://blowingthroughlines.com/wp-content/uploads/2008/01/accordion_xml.zip' title='source files for the xmled accordion'>source files for the xml&#8217;d accordion</a></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code25'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3025"><td class="code" id="p30code25"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<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> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;wp-content/xml/images.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
	loader = <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span>request<span style="color: #66cc66;">&#41;</span>;
	loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, loadComplete<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> loadComplete<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">data</span> = <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	accord = <span style="color: #000000; font-weight: bold;">new</span> accordion<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">500</span>, <span style="color: #cc66cc;">400</span>, <span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; i++<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> panel:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> NavPanel<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> contents:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #000000; font-weight: bold;">new</span> ImgHolder<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">panel</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">img</span><span style="color: #66cc66;">&#41;</span>;
		accord.<span style="color: #006600;">addPanel</span><span style="color: #66cc66;">&#40;</span>panel, contents<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	addChild<span style="color: #66cc66;">&#40;</span>accord<span style="color: #66cc66;">&#41;</span>;
	accord.<span style="color: #006600;">openPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code26'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3026"><td class="code" id="p30code26"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel one<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1905143678_218d1aa13a.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel zwei<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1904306625_fa9cf2cd33.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel tre<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1904436509_2266d2daf2.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>panel quattre<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>img/1904437975_441fec52af.jpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/img<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/panels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>



<p>Related posts:<ol><li><a href='http://blowingthroughlines.com/2009/12/13/flash-as-3/tabs-and-linefeeds-newlines-in-xml-driven-textfields/' rel='bookmark' title='Permanent Link: Tabs and Linefeeds (Newlines) in XML driven TextFields'>Tabs and Linefeeds (Newlines) in XML driven TextFields</a> <small>Man Flash can be annoying sometimes. So I&#8217;m showing some...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/01/27/cs3/accordion-meets-xml/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Tweener Tips</title>
		<link>http://blowingthroughlines.com/2007/11/20/flash-as-3/tweener-tips/</link>
		<comments>http://blowingthroughlines.com/2007/11/20/flash-as-3/tweener-tips/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 05:03:42 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2007/11/20/flash-as3/tweener-tips/</guid>
		<description><![CDATA[We&#8217;ve been using Tweener here for a few of our examples and while looking for info on Bezier Movement like the old MC_Tween used to support I came across one of Tweener&#8217;s co-creator&#8217;s blogs: labs.zeh.com.br
It has a really good post about how he decided on the syntax for the bezier Tween. It also includes a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using Tweener here for a few of our <a href="http://blowingthroughlines.com/category/wii/">examples</a> and while looking for info on Bezier Movement like the old MC_Tween used to support I came across one of Tweener&#8217;s co-creator&#8217;s blogs:<a href="http://labs.zeh.com.br/blog/?p=104" target="_blank"> labs.zeh.com.br</a><br />
It has a really good post about how he decided on the syntax for the bezier Tween. It also includes a terrific example that applies it to a <a href="http://blog.papervision.org" target="_blank">Papervision3D</a> camera object.</p>
<h4>Also:</h4>
<ul>
<li>For those not already familiar with Tweener there are some decent flas <a href="http://www.webdevils.com/?p=66">here</a>.</li>
<li>And some pretty neat tricks (especially tip 3) for the more experienced Tweenerers <a href="http://www.stimuli.com.br/trane/2007/nov/07/tweener-tips/">here</a>.</li>
</ul>
<p>Happy Tweenering.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/11/20/flash-as-3/tweener-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E4X &amp; XMLList fails when defined in a switch statement.</title>
		<link>http://blowingthroughlines.com/2007/11/17/bugs/e4x-xmllist-fails-when-defined-in-a-switch-statement/</link>
		<comments>http://blowingthroughlines.com/2007/11/17/bugs/e4x-xmllist-fails-when-defined-in-a-switch-statement/#comments</comments>
		<pubDate>Sun, 18 Nov 2007 01:01:58 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/flash-as3/nilloc/e4x-xmllist-fails-when-defined-in-a-switch-statement/</guid>
		<description><![CDATA[This one had me REALLY confused, for a good bit of time, luckily a co-worker helped be go through a rather vigorous debugging session to pinpoint the problem. Apparently if you are attempting to access a piece of a larger XML object using the new E4X capabilities and you attempt to do it with a [...]


Related posts:<ol><li><a href='http://blowingthroughlines.com/2009/09/28/bugs/external-interface-callbacks-with-jquery/' rel='bookmark' title='Permanent Link: External Interface Callbacks with Jquery'>External Interface Callbacks with Jquery</a> <small>So first off, NEVER use this most lazy of hacks...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This one had me REALLY confused, for a good bit of time, luckily a co-worker helped be go through a rather vigorous debugging session to pinpoint the problem. Apparently if you are attempting to access a piece of a larger XML object using the new E4X capabilities and you attempt to do it with a single line of code, it will return a null object instead of the expected XMLList object it should. After looking into it further, I discovered that if you define the variable, but don&#8217;t set it&#8217;s value on the same line, then it works fine&#8230; See wonky huh?</p>
<h2>Example (Based on Adobes example documentation):</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p23code35'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2335"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre></td><td class="code" id="p23code35"><pre class="actionscript" style="font-family:monospace;">package
<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>;
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> XMLListExample <span style="color: #0066CC;">extends</span> Sprite
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> books:<span style="color: #0066CC;">XML</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> XMLListExample<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		books =		<span style="color: #66cc66;">&lt;</span>books<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>book publisher=<span style="color: #ff0000;">&quot;Addison-Wesley&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Design Patterns&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>book publisher=<span style="color: #ff0000;">&quot;Addison-Wesley&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;The Pragmatic Programmer&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>book publisher=<span style="color: #ff0000;">&quot;Addison-Wesley&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Test Driven Development&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>book publisher=<span style="color: #ff0000;">&quot;Addison-Wesley&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Refactoring to Patterns&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>book publisher=<span style="color: #ff0000;">&quot;O'Reilly Media&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;The Cathedral &amp; the Bazaar&quot;</span> <span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;</span>book publisher=<span style="color: #ff0000;">&quot;O'Reilly Media&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Unit Test Frameworks&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>books<span style="color: #66cc66;">&gt;</span>;
&nbsp;
		showBooksByPublisher<span style="color: #66cc66;">&#40;</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> showBooksByPublisher<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> ner = <span style="color: #ff0000;">&quot;ren&quot;</span>;
		<span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>ner<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">case</span> <span style="color: #ff0000;">&quot;ren&quot;</span>:
			<span style="color: #808080; font-style: italic;">// the working code</span>
			<span style="color: #000000; font-weight: bold;">var</span> results:XMLList;<span style="color: #808080; font-style: italic;">// = new XMLList();</span>
			results = books.<span style="color: #006600;">book</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">@</span>publisher == <span style="color: #ff0000;">&quot;Addison-Wesley&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;results:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>+results<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// returns a the first 4 items (which contain &quot;Adison...&quot;)</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">// now for the fun!!!</span>
			<span style="color: #000000; font-weight: bold;">var</span> otherResults:XMLList = books.<span style="color: #006600;">book</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">@</span>publisher == <span style="color: #ff0000;">&quot;O'Reilly Media&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;other results:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>+otherResults<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// returns null? (actually a null object)</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">// just to see if oneline variable definitions work</span>
			<span style="color: #000000; font-weight: bold;">var</span> test:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'ner'</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test string: &quot;</span>+test<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// seeing what else is a problem to do this way</span>
			<span style="color: #000000; font-weight: bold;">var</span> objTest:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span>ner:<span style="color: #ff0000;">&quot;ren&quot;</span><span style="color: #66cc66;">&#125;</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'test object: '</span>+objTest.<span style="color: #006600;">ner</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// yup works fine.</span>
			<span style="color: #808080; font-style: italic;">//</span>
			<span style="color: #000000; font-weight: bold;">var</span> xmlTest:<span style="color: #0066CC;">XML</span> = <span style="color: #66cc66;">&lt;</span>ners<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>ner<span style="color: #66cc66;">&gt;</span>ren<span style="color: #66cc66;">&lt;/</span>ner<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>ners<span style="color: #66cc66;">&gt;</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'test xml:<span style="color: #000099; font-weight: bold;">\n</span>'</span>+xmlTest<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// no problem here either.</span>
			<span style="color: #808080; font-style: italic;">//</span>
			<span style="color: #000000; font-weight: bold;">var</span> numTest:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">45</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'test number: '</span>+numTest<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// this is fine too.</span>
			<span style="color: #b1b100;">break</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>ner == <span style="color: #ff0000;">&quot;ren&quot;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> otherOtherResults:XMLList = books.<span style="color: #006600;">book</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">@</span>publisher == <span style="color: #ff0000;">&quot;O'Reilly Media&quot;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;other other results:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>+otherOtherResults<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// works fine as well.</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span><span style="color: #808080; font-style: italic;">// end of class</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p><a href="http://blowingthroughlines.com/wp-content/uploads/2007/11/xmllist_bug_tester.zip" title="Tester file for the XMLList Bug">Download the code.</a></p>
<p>Tell your friends, I&#8217;m letting Adobe know. And please let us know if your testing shows differently.</p>


<p>Related posts:<ol><li><a href='http://blowingthroughlines.com/2009/09/28/bugs/external-interface-callbacks-with-jquery/' rel='bookmark' title='Permanent Link: External Interface Callbacks with Jquery'>External Interface Callbacks with Jquery</a> <small>So first off, NEVER use this most lazy of hacks...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/11/17/bugs/e4x-xmllist-fails-when-defined-in-a-switch-statement/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>As3 event management</title>
		<link>http://blowingthroughlines.com/2007/11/03/flash-as-3/as3-event-management/</link>
		<comments>http://blowingthroughlines.com/2007/11/03/flash-as-3/as3-event-management/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 13:44:46 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/flash-as3/jeff/as3-event-management/</guid>
		<description><![CDATA[Recently while working on an as3 project the project manager of the project came over to me and asked that something happen automatically that was currently happening only on a mouse click.  Normally I would have said fuck you that is impossible and get the hell out of my face.  I was feeling [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Recently while working on an as3 project the project manager of the project came over to me and asked that something happen automatically that was currently happening only on a mouse click.  Normally I would have said fuck you that is impossible and get the hell out of my face.  I was feeling confident today though with the event model of as3 so I said yeah I think we can make that happen.  The logic was that at worst I would have to make a separate function based on the one I already had.  So in a quest to solve this problem I offer you the most awesome kick ass thing you could ask for.</p>
<p>With as3 you quite literally fake an event.  And you can do so very easily.  All you need to do is import the events classes:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p21code41'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2141"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p21code41"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;</pre></td></tr></table></div>

<p>Then any time you have a button you can fake whatever event you want.  You can fake all sorts of events not just button.  But faking a click is often the most useful.  The code for doing such a thing is as follows.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p21code42'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2142"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p21code42"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// note you must make a symbol and link it in order to make an instance.</span>
<span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	mybutton = <span style="color: #000000; font-weight: bold;">new</span> customSymbolIHaveLinked<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	mybutton.<span style="color: #006600;">mouseChildren</span> = <span style="color: #000000; font-weight: bold;">false</span>;
	mybutton.<span style="color: #006600;">mouseEnabled</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">// this makes the button listen for the click event</span>
	mybutton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, functiontorun<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// now if you would like to automatially run this event on start up to perhaps ensure the user is at a default</span>
	<span style="color: #808080; font-style: italic;">// position you simply need to dispatch an event</span>
&nbsp;
	mybutton.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> functiontorun<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;recieved event from &quot;</span>+evt.<span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>That&#8217;s all there is to it really.  I hope this has been helpful.  It has been a lifesaver for me.  Thanks again as3 for making life a hell of a lot easier&#8230;</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/11/03/flash-as-3/as3-event-management/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Animator Class Enhancement</title>
		<link>http://blowingthroughlines.com/2007/10/03/cs3/animator-class-enhancement/</link>
		<comments>http://blowingthroughlines.com/2007/10/03/cs3/animator-class-enhancement/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 21:07:35 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/uncategorized/nilloc/animator-class-enhancement/</guid>
		<description><![CDATA[I don&#8217;t know how much exploration of the Animator class many people have done out there, but a current project seemed like a good place to experiment with it. I&#8217;m pretty impressed with Adobe&#8217;s implementation of it&#8212;though I&#8217;m far more impressed with the capabilities of E4X XML tools that make it possible&#8212;but some things are [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know how much exploration of the Animator class many people have done out there, but a current project seemed like a good place to experiment with it. I&#8217;m pretty impressed with Adobe&#8217;s implementation of it&mdash;though I&#8217;m far more impressed with the capabilities of E4X XML tools that make it possible&mdash;but some things are less then ready for prime-time.</p>
<p>Basically, flashes Animator.play()</p>
<h3>Example</h3>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2007/10/animatorspeed.swf" width="500" height="250" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2007/10/animatorspeed.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<h3>How it works</h3>
<p>This Assumes the code is on frame 1 of the main timeline.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p19code44'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1944"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
</pre></td><td class="code" id="p19code44"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">motion</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//stage.frameRate = fps;</span>
<span style="color: #808080; font-style: italic;">//trace(stage.frameRate);</span>
<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/*************  this is the speed controller (or delay controller) *************/</span>
<span style="color: #000000; font-weight: bold;">var</span> player:Timer = <span style="color: #000000; font-weight: bold;">new</span> Timer<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">33</span>,<span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// &quot;33&quot;/1000th of a second is pretty much 30 fps and the animation is &quot;30&quot; frames long</span>
	player.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TimerEvent.<span style="color: #006600;">TIMER</span>, playAnimator<span style="color: #66cc66;">&#41;</span>;
	player.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> playAnimator<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:TimerEvent<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: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #006600;">currentCount</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		ner_animator.<span style="color: #0066CC;">time</span> = <span style="color: #0066CC;">e</span>.<span style="color: #006600;">currentTarget</span>.<span style="color: #006600;">currentCount</span>;
	<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
		ner_animator.<span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		ner_animator.<span style="color: #006600;">rewind</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		player.<span style="color: #006600;">reset</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		player.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/************* speed controlled animator (taken straight from the clipboard but with the Animator.play() removed *************/</span>
<span style="color: #000000; font-weight: bold;">var</span> ner_xml:<span style="color: #0066CC;">XML</span> = <span style="color: #66cc66;">&lt;</span>motion <span style="color: #0066CC;">duration</span>=<span style="color: #ff0000;">&quot;30&quot;</span> xmlns=<span style="color: #ff0000;">&quot;fl.motion.*&quot;</span> xmlns:geom=<span style="color: #ff0000;">&quot;flash.geom.*&quot;</span> xmlns:filters=<span style="color: #ff0000;">&quot;flash.filters.*&quot;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>source<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>source frameRate=<span style="color: #ff0000;">&quot;10&quot;</span> x=<span style="color: #ff0000;">&quot;95&quot;</span> y=<span style="color: #ff0000;">&quot;114&quot;</span> scaleX=<span style="color: #ff0000;">&quot;1&quot;</span> scaleY=<span style="color: #ff0000;">&quot;1&quot;</span> rotation=<span style="color: #ff0000;">&quot;0&quot;</span> elementType=<span style="color: #ff0000;">&quot;movie clip&quot;</span> instanceName=<span style="color: #ff0000;">&quot;ner&quot;</span> symbolName=<span style="color: #ff0000;">&quot;Symbol 1&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>dimensions<span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>geom:Rectangle <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;42&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;42&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>dimensions<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>transformationPoint<span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>geom:Point x=<span style="color: #ff0000;">&quot;0.5&quot;</span> y=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>transformationPoint<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>source<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>source<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>keyframe <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;0&quot;</span> tweenSnap=<span style="color: #ff0000;">&quot;true&quot;</span> tweenSync=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>tweens<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>simpleEase ease=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>tweens<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>keyframe<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>keyframe <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;29&quot;</span> tweenSync=<span style="color: #ff0000;">&quot;true&quot;</span> x=<span style="color: #ff0000;">&quot;253&quot;</span><span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;/</span>motion<span style="color: #66cc66;">&gt;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> ner_animator:Animator = <span style="color: #000000; font-weight: bold;">new</span> Animator<span style="color: #66cc66;">&#40;</span>ner_xml, ner<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//ner_animator.play(); // removed because we play it with the new player function</span></pre></td></tr></table></div>

<p>So as you can see, it&#8217;s just replacing whatever the built in play() function does (likely some kind of onEnterFrame event) with a Timer driven, and thus framerate independent animation. Which allows old slow computers to keep things moving more like the Tween or Tweener class, frames will be skipped to keep the timing more or less on track (as much as possible).</p>
<p>I&#8217;m planning on releasing an class that extends the Animator class built into flash&mdash;or possibly building a new one from scratch&mdash;that will include this speed feature as well as other enhancements I&#8217;ve required in the last project (also coming soon).</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/10/03/cs3/animator-class-enhancement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto-scrolling select box</title>
		<link>http://blowingthroughlines.com/2007/09/26/flash-as-3/auto-scrolling-select-box/</link>
		<comments>http://blowingthroughlines.com/2007/09/26/flash-as-3/auto-scrolling-select-box/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 04:41:24 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/uncategorized/jeff/auto-scrolling-select-box/</guid>
		<description><![CDATA[Recently I worked on a project that required a very customized select box.  Instead of a scrollbar the box would auto scroll depending on the mouse position.  The items needed to be click-able and also have a rollover state.  I came up with the MaskedSlider class to solve my sliding problems.  [...]


Related posts:<ol><li><a href='http://blowingthroughlines.com/2009/12/12/electronics/new-boom-box-find/' rel='bookmark' title='Permanent Link: New Boom Box find.'>New Boom Box find.</a> <small>On our almost bi-weekly visit to the Goodwill store nearby,...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Recently I worked on a project that required a very customized select box.  Instead of a scrollbar the box would auto scroll depending on the mouse position.  The items needed to be click-able and also have a rollover state.  I came up with the MaskedSlider class to solve my sliding problems.  Currently the function for the scrolling is hardcoded.  I leave it as an exercise to the reader to implement whatever scrolling animation function the see fit.<br />
<object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2007/09/slider.swf" width="550" height="300" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2007/09/slider.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p>download the source here <a href="http://blowingthroughlines.com/wp-content/uploads/2007/09/sliderdemo1.zip" title="slider demo">slider demo</a></p>
<p>The class is fairly easy to use and can be instantiated as a UP_DOWN list or a LEFT_RIGHT list by setting the proper value in the constructor, as shown below in the simple example.  Futhermore, you may set a background color, width, height, and the extra hit width and height you would like to allow.  The hit length allows the movement to continue even when you have moused off the compnent.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p17code48'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1748"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code" id="p17code48"><pre class="actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> TopLevel;
	<span style="color: #0066CC;">import</span> hg.<span style="color: #006600;">paginators</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> main <span style="color: #0066CC;">extends</span> TopLevel
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> slider1:MaskedSlider;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> slider2:MaskedSlider;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			slider1 = <span style="color: #000000; font-weight: bold;">new</span> MaskedSlider<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">195</span>,<span style="color: #cc66cc;">170</span>,MaskedSlider.<span style="color: #006600;">UP_DOWN</span>,0xFFFFFF,<span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
			slider2 = <span style="color: #000000; font-weight: bold;">new</span> MaskedSlider<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">460</span>,<span style="color: #cc66cc;">42</span>, MaskedSlider.<span style="color: #006600;">LEFT_RIGHT</span>, 0xFFFFFF,<span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>slider1<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>slider2<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// add 15 items</span>
			<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i=<span style="color: #cc66cc;">0</span>; i<span style="color: #66cc66;">&lt;</span><span style="color: #cc66cc;">15</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				slider1.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> item,rOver,rOut<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<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: #cc66cc;">0</span>; j<span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">15</span>; j++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				slider2.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> item,rOver,rOut<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			slider1.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;">30</span>;
			slider1.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;">30</span>;
			slider2.<span style="color: #006600;">y</span>=<span style="color: #cc66cc;">220</span>;
			slider2.<span style="color: #006600;">x</span>=<span style="color: #cc66cc;">30</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> rOver<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			evt.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">alpha</span>=<span style="color: #cc66cc;">0.7</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> rOut<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			evt.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">alpha</span>=<span style="color: #cc66cc;">1</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>There are some interesting properties in this class as well as a <strong>changed</strong> event that you can subscribe to.  Below are the relevent methods and properties from the class, a brief description of the functionality, and usage examples.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p17code49'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1749"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p17code49"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">//three methods worth using</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//change background</span>
slider1.<span style="color: #0066CC;">background</span><span style="color: #66cc66;">&#40;</span>0xFF99FF<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//set speed</span>
slider1.<span style="color: #006600;">setSpeed</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//empty contents of the slider so that you can populate with new items</span>
slider1.<span style="color: #006600;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//set the default selected item useful for making sure there are no null values passed to other objects</span>
<span style="color: #808080; font-style: italic;">// where 3 is the item number</span>
slider1.<span style="color: #006600;">setDefaultSelect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>So that block took you through some of the useful methods implemented for you.  There is one piece of functionality I have left out.  The slider is written so that you can select an item from a list of items.  Below is a brief example of how you would accomplish this.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p17code50'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1750"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p17code50"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// you must subscribe to the change even</span>
slider1.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MaskedSlider.<span style="color: #006600;">EVENT_ON_CHANGE</span>, doSomething<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> doSomething<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">//to get the selected item</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">sItem</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//to get the index chosen</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">itemIndex</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>That should get you started using this class. Although it is far from complete, I think the slider would make a great addition to many projects.  Be creative with what you scroll.  Remember an item can be any movie clip <img src='http://blowingthroughlines.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>Related posts:<ol><li><a href='http://blowingthroughlines.com/2009/12/12/electronics/new-boom-box-find/' rel='bookmark' title='Permanent Link: New Boom Box find.'>New Boom Box find.</a> <small>On our almost bi-weekly visit to the Goodwill store nearby,...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/09/26/flash-as-3/auto-scrolling-select-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WiiSizing Text Class</title>
		<link>http://blowingthroughlines.com/2007/09/26/flash-as-3/wii/wiisizing-text-class/</link>
		<comments>http://blowingthroughlines.com/2007/09/26/flash-as-3/wii/wiisizing-text-class/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 20:37:45 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>
		<category><![CDATA[Wii]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/flash-as-30/nilloc/wiisizing-text-class/</guid>
		<description><![CDATA[So any of you out there that have played with a Nintendo Wii yet&#8212;or more specifically run out of energy bowling all night and decided to look at the news reader built into it&#8212;will have probably been pretty impressed with the dynamic nature of the interface elements. This class allows users to resize text in [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>So any of you out there that have played with a Nintendo Wii yet&mdash;or more specifically run out of energy bowling all night and decided to look at the news reader built into it&mdash;will have probably been pretty impressed with the dynamic nature of the interface elements. This class allows users to resize text in a fun and smooth way, and does the text resizing on a string within the confines set by you. So there <em>optionally</em> is a max size set by a defined bounding box.</p>
<h3>Example</h3>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2007/09/textresizer.swf" width="550" height="400" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2007/09/textresizer.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object><br />
It requires Tweener at the moment, but i plan on refactoring it to allow you to pass the tweening in your preferred class (though promoting the use of Tweener isn&#8217;t a bad thing in my opinion).</p>
<h3>How to instantiate and use the class</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p13code53'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1353"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p13code53"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// import the class</span>
<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">paperclipped</span>.<span style="color: #0066CC;">text</span>.<span style="color: #006600;">TextResizer</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// make an new instance of it 'this' refers to the stage in this example, but could be any DisplayObject.</span>
<span style="color: #000000; font-weight: bold;">var</span> myResizer:TextResizer = <span style="color: #000000; font-weight: bold;">new</span> TextResizer<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;all the words i really wanted to deal with at the moment&quot;</span>, <span style="color: #0066CC;">this</span>, <span style="color: #66cc66;">&#123;</span>t:<span style="color: #cc66cc;">0</span>, r:<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span>, b:<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span>, l:<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// to change the size of the text, +/- change in point size, easing style, speed, and optionally a delay for a ripple effect</span>
myResizer.<span style="color: #006600;">resizeText</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">6</span>, <span style="color: #ff0000;">'easeoutquad'</span> ,<span style="color: #cc66cc;">0.5</span>, <span style="color: #cc66cc;">0.08</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>It&#8217;s pretty short and simple but a neat &lsquo;discovery&rsquo; for your users when the need a closer look at some text that was spec&#8217;d a little too small for them <a href='http://blowingthroughlines.com/wp-content/uploads/2007/09/textresizer.zip' title='TextResizer - Source'>Download the  TextResizer Source</a>. There are also settings for tracking [letterSpacing across the whole string] and wordspacing that can be optionally defined. And if you just need to resize the text and have it bounce down instantly you can leave out the time, or easing type parts and just use:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p13code54'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1354"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p13code54"><pre class="actionscript" style="font-family:monospace;">myResizer.<span style="color: #006600;">resizeText</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">6</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>



<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/09/26/flash-as-3/wii/wiisizing-text-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accordion Component AS3 flash 9</title>
		<link>http://blowingthroughlines.com/2007/09/17/flash-as-3/accordion-component-as3-flash-9/</link>
		<comments>http://blowingthroughlines.com/2007/09/17/flash-as-3/accordion-component-as3-flash-9/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 01:59:40 +0000</pubDate>
		<dc:creator>jeff</dc:creator>
				<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/flash-as-30/nilloc/accordion-component-as3-flash-9/</guid>
		<description><![CDATA[If you have been using flash 9 with as3 you have perhaps figured out that there is no accordion component. While what I have made is not a component, it is a rather easy to use lightweight class i&#8217;m sure you will find useful.  Below is the most basic example and usage of the [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>If you have been using flash 9 with as3 you have perhaps figured out that there is no accordion component. While what I have made is not a component, it is a rather easy to use lightweight class i&#8217;m sure you will find useful.  Below is the most basic example and usage of the class.  it automatically takes care of the masking and buttons required to achieve this simple effect.</p>
<h3>Example Result</h3>
<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2007/09/accordion.swf" width="400" height="300" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2007/09/accordion.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<h3>How to instantiate and use the class</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p10code57'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1057"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p10code57"><pre class="actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> TopLevel;
	<span style="color: #0066CC;">import</span> src.<span style="color: #006600;">navigation</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> src.<span style="color: #006600;">utils</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">Tweener</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> main <span style="color: #0066CC;">extends</span> TopLevel
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> accord:accordion;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			accord = <span style="color: #000000; font-weight: bold;">new</span> accordion<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">400</span>, <span style="color: #cc66cc;">300</span>,<span style="color: #cc66cc;">4</span>, <span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span>accord<span style="color: #66cc66;">&#41;</span>;
			accord.<span style="color: #006600;">addPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> navpanel, <span style="color: #000000; font-weight: bold;">new</span> contents<span style="color: #66cc66;">&#41;</span>;
			accord.<span style="color: #006600;">addPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> navpanel, <span style="color: #000000; font-weight: bold;">new</span> contents<span style="color: #66cc66;">&#41;</span>;
			accord.<span style="color: #006600;">addPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> navpanel, <span style="color: #000000; font-weight: bold;">new</span> contents<span style="color: #66cc66;">&#41;</span>;
			accord.<span style="color: #006600;">addPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> navpanel, <span style="color: #000000; font-weight: bold;">new</span> contents<span style="color: #66cc66;">&#41;</span>;
			accord.<span style="color: #006600;">openPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</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></pre></td></tr></table></div>

<p>As you can see the code is quite simple.  You create an instance and add content as necessary.  For the moment I have only programmed a horizontal accordion.  However it would not be difficult to create a vertical one if your project required it.  If you would just like to use this example and start hacking around please <a href="http://blowingthroughlines.com/wp-content/uploads/2007/09/blowingthroughlinescom_accordion.zip" title="btl-accordion">Download the Source</a> and mess around all you want.  for a more in depth explanation of more advanced functionality keep reading.</p>
<p>To make a new accordion object, just instantiate the class as shown in the main class section.  The openPanel function is self explanatory. enter a number from 1 to number of panels.  You can access the internal movie clip of a panel by using getPanelContentsAt.  Useful if you would like to change text within one of your panels or replace it with something else.</p>
<p>The last very useful piece of functionality worth mentioning is the event that is generated when you change panels. This is useful because if a button outside of the accordion changes the panel any other object can react accordingly (pun intended).  This comes in handy for contextual navigation when a user has reached the end of the accordion.  Below is a small code snippet of how you would subscribe to the event and do something with the info.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p10code58'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1058"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p10code58"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">//add this to the main function or perhaps an init function</span>
accord.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>accordion.<span style="color: #006600;">EVENT_ON_CHANGE</span>, somethingchanged<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> somethingchanged<span style="color: #66cc66;">&#40;</span>evt:Event<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;the panel changed to number &quot;</span>+accord.<span style="color: #006600;">currpanel</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>



<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2007/09/17/flash-as-3/accordion-component-as3-flash-9/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>
