<?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>Sebastiaan Holtrop</title>
	<atom:link href="http://www.sebastiaanholtrop.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sebastiaanholtrop.com</link>
	<description>Creating stuff that works...</description>
	<lastBuildDate>Mon, 08 Feb 2010 11:39:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flex Application background gradient</title>
		<link>http://www.sebastiaanholtrop.com/archives/112</link>
		<comments>http://www.sebastiaanholtrop.com/archives/112#comments</comments>
		<pubDate>Mon, 08 Feb 2010 11:36:21 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=112</guid>
		<description><![CDATA[After doing some actionscript-only projects for a while I&#8217;m back working with Flex now. It&#8217;s good to not have to build my scrollbars and such entirely by hand.
Unfortunately, some things that take a few seconds in flash to build sometimes take a few hours in Flex, like this for instance:
I wanted a radial gradient graphic [...]]]></description>
			<content:encoded><![CDATA[<p>After doing some actionscript-only projects for a while I&#8217;m back working with Flex now. It&#8217;s good to not have to build my scrollbars and such entirely by hand.<br />
Unfortunately, some things that take a few seconds in flash to build sometimes take a few hours in Flex, like this for instance:</p>
<p>I wanted a radial gradient graphic as a background in my application. The Flex application tag supports linear gradients but not the radial one. I could set a huge graphic (png) as the backgroundImage for the Application, but that would add filesize to my swf file. I could extendApplication and override the updateDisplayList function and draw my graphic there, but I don&#8217;t think that&#8217;s the way to go either.</p>
<p>So I tried creating a programmatic skin which may sound like the right solution, but which styleable property do we need to attach the Classreference to? Here&#8217;s the solution:</p>
<p>Style the Application tag. Set the Classreference on the backgroundImage property (who would have guessed that one). Don&#8217;t forget to set the backgroundSize property to 100%, otherwise our graphic won&#8217;t stretch to the full size of the container.</p>

<div class="wp_codebox"><table><tr id="p1123"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p112code3"><pre class="actionscript" style="font-family:monospace;">Application <span style="color: #66cc66;">&#123;</span>
backgroundImage: ClassReference<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test.skins.ApplicationBackgroundSkin&quot;</span><span style="color: #66cc66;">&#41;</span>;
backgroundSize: <span style="color: #ff0000;">&quot;100%&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Then create a programmatic skin class by extending the ProgrammaticSkin class and override the following functions:</p>

<div class="wp_codebox"><table><tr id="p1124"><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
</pre></td><td class="code" id="p112code4"><pre class="actionscript" style="font-family:monospace;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> measuredWidth<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> <span style="color: #cc66cc;">200</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> measuredHeight<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> <span style="color: #cc66cc;">200</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
protected override <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth:<span style="color: #0066CC;">Number</span>, unscaledHeight:<span style="color: #0066CC;">Number</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> mat:Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> colors:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>0xEAEAEA, 0xFFFFFF<span style="color: #66cc66;">&#93;</span>;
<span style="color: #000000; font-weight: bold;">var</span> alphas:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>;
<span style="color: #000000; font-weight: bold;">var</span> ratios:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
mat.<span style="color: #006600;">createGradientBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">200</span>,<span style="color: #cc66cc;">200</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
graphics.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
graphics.<span style="color: #0066CC;">beginGradientFill</span><span style="color: #66cc66;">&#40;</span>GradientType.<span style="color: #006600;">RADIAL</span>, colors, alphas, ratios, mat<span style="color: #66cc66;">&#41;</span>;
graphics.<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;">200</span>,<span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span>;
graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Draw the graphic in the updateDisplayList function. Don&#8217;t forget to override the getters for measuredWidth and measuredHeight. If you don&#8217;t, the programmatic skin doesn&#8217;t have a width and height and the graphic wil not be visible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/112/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flex 3 localisation</title>
		<link>http://www.sebastiaanholtrop.com/archives/95</link>
		<comments>http://www.sebastiaanholtrop.com/archives/95#comments</comments>
		<pubDate>Wed, 18 Nov 2009 08:49:47 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Localisation]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=95</guid>
		<description><![CDATA[Something I&#8217;ve found out this morning; If you want to include localized resourced in your project other then en_US, for instance nl_NL, you not only have to create resource files for your own application, but you also need to provide the localized resources for the Flex Framework components. Flex doesn&#8217;t have all these localized resources [...]]]></description>
			<content:encoded><![CDATA[<p>Something I&#8217;ve found out this morning; If you want to include localized resourced in your project other then en_US, for instance nl_NL, you not only have to create resource files for your own application, but you also need to provide the localized resources for the Flex Framework components. Flex doesn&#8217;t have all these localized resources out of the box, but Adobe provides a command line tool to copy these resources. It&#8217;s called copylocale.</p>
<p>Now I&#8217;m not frequent user of the command line, but I know terminal (on my mac) a bit, so I just navigated to the bin directory of my Flex sdk and did this:</p>
<pre>copylocale en_US nl_NL</pre>
<p>Didn&#8217;t work. Terminal just sais:</p>
<pre>-bash: copylocale: command not found</pre>
<p>Turns out you have to call the copylocale command from the root directory of your sdk, and include the /bin in the command call, like this:</p>
<pre>bin/copylocale en_US nl_NL</pre>
<p>Damn command line tools, no one ever tells you this stuff.</p>
<p>Some more info on runtime localisation:<br />
<a href="http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:_Runtime_Localization" target="_blank">http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:_Runtime_Localization</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/95/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JigLibFlash physics and Away3D experiment</title>
		<link>http://www.sebastiaanholtrop.com/archives/85</link>
		<comments>http://www.sebastiaanholtrop.com/archives/85#comments</comments>
		<pubDate>Thu, 09 Apr 2009 13:26:47 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[JigLibFlash]]></category>
		<category><![CDATA[Physics]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=85</guid>
		<description><![CDATA[I wanted to do some real 3d physics for quite some time, but there just weren&#8217;t really good actionscript 3 physics engines around. There are 2 real options:

WOW Physics engine: This is a particle based engine, which means every vertex has it&#8217;s own physics properties
JigLibFlash Physics engine: This is a Rigid Body based engine. You [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to do some real 3d physics for quite some time, but there just weren&#8217;t really good actionscript 3 physics engines around. There are 2 real options:</p>
<ul>
<li><a title="WOW Physics engine" href="http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/" target="_blank">WOW Physics engine</a>: This is a particle based engine, which means every vertex has it&#8217;s own physics properties</li>
<li><a title="JigLibFlash Physics engine" href="http://www.jiglibflash.com/blog/" target="_blank">JigLibFlash Physics engine</a>: This is a Rigid Body based engine. You work with primitive types like boxes and speres to create a rough shape of you 3d object. These rigid body based engines are faster than particle based engines, because there&#8217;s just one rigid body with physics properties instead of (in case of a simple cube) 8.</li>
</ul>
<p>There&#8217;s quite a lot of examples around built with JigLibFlash and Papervision3D. Because I prefer building my 3D stuff in Away3D, I wanted to create some 3D physics with JigLibFlash and Away3D. Here&#8217;s a simple example of how it works:</p>
<div class="mceTemp">
<dl id="attachment_87" class="wp-caption alignnone" style="width: 510px;">
<dt class="wp-caption-dt"><a title="JiglibFlash and Away3D example" href="http://sebastiaanholtrop.com/samples/jiglibflashexperiment/example/" target="_blank"><img class="size-full wp-image-87" title="jiglibflash-and-away3d-experiment" src="http://www.sebastiaanholtrop.com/wp-content/jiglibflash-and-away3d-experiment.jpg" alt="JigLibFlash and Away3D experiment" width="500" height="300" /></a></dt>
</dl>
</div>
<p>Just use the arrow keys to move the ball around, try to get it to jump the ramp <img src='http://www.sebastiaanholtrop.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . You can <a title="Download source code jiglibFlash Away3D example" href="http://www.sebastiaanholtrop.com/samples/jiglibflashexperiment/JigLibAway3DExperiment.zip" target="_self">download the source code here</a>.</p>
<p>That&#8217;s it for now. it takes a lot of time to figure out how everything works because these physics engines are still buggy and undocumented (grrr). The project members of JigLibFlash did a great job by porting this c++ engine to actionscript, but, for an open source project to be successful they better start documenting the source code (I know it&#8217;s a boring job) instead of creating demo apps with Papervision, which, in my opinion is not the best 3D engine around.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/85/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SebCoverFlow 2.2.1 available</title>
		<link>http://www.sebastiaanholtrop.com/archives/83</link>
		<comments>http://www.sebastiaanholtrop.com/archives/83#comments</comments>
		<pubDate>Thu, 09 Apr 2009 11:43:30 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[CoverFlow]]></category>
		<category><![CDATA[Flex 2]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=83</guid>
		<description><![CDATA[Since the release of the source code of my coverflow component there was just one bug that came up again and again. The coverflow couldn&#8217;t load images from a subdomain or another domain. I&#8217;ve fixed that one by adding a LoaderContext to the Image loader. The new sources and samples are available on the SebCoverFlow [...]]]></description>
			<content:encoded><![CDATA[<p>Since the release of the source code of my coverflow component there was just one bug that came up again and again. The coverflow couldn&#8217;t load images from a subdomain or another domain. I&#8217;ve fixed that one by adding a LoaderContext to the Image loader. The new sources and samples are available on the <a title="SebCoverFlow project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">SebCoverFlow project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/83/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Create ASDoc code documentation with ANT</title>
		<link>http://www.sebastiaanholtrop.com/archives/38</link>
		<comments>http://www.sebastiaanholtrop.com/archives/38#comments</comments>
		<pubDate>Tue, 10 Feb 2009 09:48:56 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[ASDoc]]></category>
		<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Ant]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=38</guid>
		<description><![CDATA[Working with command lines really sucks, so prefer automating any of those boring tasks by using any kind of script. Back when I was running Windows XP on a PC, I used batch files to do some of those tasks, but since I&#8217;m using a mac I can&#8217;t run batch files anymore. Furthermore, it was [...]]]></description>
			<content:encoded><![CDATA[<p>Working with command lines really sucks, so prefer automating any of those boring tasks by using any kind of script. Back when I was running Windows XP on a PC, I used batch files to do some of those tasks, but since I&#8217;m using a mac I can&#8217;t run batch files anymore. Furthermore, it was time to switch to something more professional than those oldschool batch files. I&#8217;ve been using ANT for quite some time now and I&#8217;ve created a really simple ANT script to create ASDoc documentation.</p>
<p><strong>What is ANT?</strong><br />
You can do about anyting with ANT by creating an ANT Script (xml) that tells ANT what to do. ANT can do anyting with files (copy, paste, move, duplicate, extract zip files, etc) and with ANT you can execute applications which you would normally use through the command line (or Terminal on a Mac).</p>
<p><strong>ASDoc ANT Script</strong><br />
Ok, back to the ASDoc ant script. Click &#8220;File -&gt; New -&gt; File&#8221; and create a file called asdocbuild.xml. Paste this code into the xml file:</p>

<div class="wp_codebox"><table><tr id="p386"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p38code6"><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;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ASDoc build&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;createdocs&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;property</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;asdoc.properties&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;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;createdocs&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;${asdoc.dir}/asdoc&quot;</span> <span style="color: #000066;">failonerror</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;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-doc-sources 'src/'&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-main-title 'Undercore, a Flash and Flex development framework'&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-window-title 'Undercore'&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-output 'docs'&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Some explanation of what happens in the xml file above: Obviously it&#8217;s an xml file (line 1).  The project tag defines the projectname of the build and the default target to execute, in this case the target on line 5 called createdocs. This node contains an exec node which tells ANT to execute a command line statement with the arguments contained in the exec tag. This is the actual asdoc execution.</p>
<p>Before it executes any of the targets, it loads a properties file. You can define variables in a properties file, such as ${asdoc.dir} which is defined as asdoc.dir in the property file. This is the properties file content:</p>
<pre>asdoc.dir=/Applications/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/bin</pre>
<p>Just create a file named asdoc.properties and paste the code above in it. Your project should look something like this:</p>
<p><img class="alignnone size-full wp-image-73" title="ANT Project" src="http://www.sebastiaanholtrop.com/wp-content/antproject.gif" alt="ANT Project" width="196" height="164" /></p>
<p>Now right-click the asdocbuild.xml file and choose Run As -&gt; Ant Build. Your documentation&#8217;s being created.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/38/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mask an Away3D scene in Flex</title>
		<link>http://www.sebastiaanholtrop.com/archives/29</link>
		<comments>http://www.sebastiaanholtrop.com/archives/29#comments</comments>
		<pubDate>Thu, 18 Sep 2008 20:59:48 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Adobe Flex 3]]></category>
		<category><![CDATA[Away3D]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=29</guid>
		<description><![CDATA[An Away3D scene usually takes up the full width and height of the embedded swf file in the browser. In Flash you can easily solve this problem by masking the Away3D view.
The same thing goes for Flex, but Flex has it&#8217;s own measuring and sizing methods. I&#8217;ve come to know that it&#8217;s a great thing [...]]]></description>
			<content:encoded><![CDATA[<p>An Away3D scene usually takes up the full width and height of the embedded swf file in the browser. In Flash you can easily solve this problem by masking the Away3D view.</p>
<p>The same thing goes for Flex, but Flex has it&#8217;s own measuring and sizing methods. I&#8217;ve come to know that it&#8217;s a great thing as regards to performance, maintainability and scalability of your component to adapt to the Flex Framework.</p>
<p>In this case, I&#8217;ve extended a Flex component. The new Component contains an Away3D scene, which wants to take up the full width and height of my Flex Application. To solve this we need to override the updateDisplayList method. This method get&#8217;s called by the Flex Framework every time something in the measuring has changed. Here&#8217;s how it looks in code:</p>

<div class="wp_codebox"><table><tr id="p298"><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
</pre></td><td class="code" id="p29code8"><pre class="actionscript" style="font-family:monospace;">override protected <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth:<span style="color: #0066CC;">Number</span>, unscaledHeight:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
<span style="color: #0066CC;">super</span>.<span style="color: #006600;">updateDisplayList</span><span style="color: #66cc66;">&#40;</span>unscaledWidth, unscaledHeight<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Set the clipping of the 3D scene to make sure only the visible elements are rendered,</span>
<span style="color: #808080; font-style: italic;">// this is great improvement for the performance</span>
<span style="color: #000000; font-weight: bold;">var</span> clipping:RectangleClipping = <span style="color: #000000; font-weight: bold;">new</span> RectangleClipping<span style="color: #66cc66;">&#40;</span>-<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>, -<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Asign the clipping to the _view3D, in this case a private variable within my class</span>
_view3D.<span style="color: #006600;">clip</span> = clipping;
&nbsp;
<span style="color: #808080; font-style: italic;">// Remove the old mask if there is one</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_mask <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>_mask<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// Create a new mask</span>
_mask = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
_mask.<span style="color: #006600;">x</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">x</span>;
_mask.<span style="color: #006600;">y</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">y</span>;
_mask.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFF0000,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
_mask.<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: #0066CC;">this</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
_mask.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Add it to the displayList</span>
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>_mask<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// And assign the mask to the view3D</span>
_view3D.<span style="color: #006600;">mask</span> = _mask;
&nbsp;
<span style="color: #808080; font-style: italic;">// And center the view3D in the available space</span>
_view3D.<span style="color: #006600;">x</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>;
_view3D.<span style="color: #006600;">y</span> = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>So as you see above, it&#8217;s quite straighforward. The clipping in the beginning of the method is not necessary for the masking, but since only the masked area is being displayed, there&#8217;s no need to render the invisible parts of the view3D.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/29/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic Flex CoverFlow Component with dataProvider</title>
		<link>http://www.sebastiaanholtrop.com/archives/27</link>
		<comments>http://www.sebastiaanholtrop.com/archives/27#comments</comments>
		<pubDate>Thu, 11 Sep 2008 19:17:08 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[CoverFlow]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=27</guid>
		<description><![CDATA[There&#8217;s a project page of this component now, check it here, it&#8217;s open source!
As you may have read in a few of my other posts I&#8217;ve hacked a CoverFlow component together, just to see if it could be done. I was glad to see a lot of people liked it, so I decided to turn [...]]]></description>
			<content:encoded><![CDATA[<p><a title="SebCoverflow Project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">There&#8217;s a project page of this component now, check it here, it&#8217;s open source!</a></p>
<p>As you may have read in a few of my other posts I&#8217;ve hacked a CoverFlow component together, just to see if it could be done. I was glad to see a lot of people liked it, so I decided to turn it into a proper component instead of the &#8220;hacked together&#8221; version I&#8217;ve posted before.</p>
<p><a title="Flex 2 CoverFlow component sample application" href="http://www.sebastiaanholtrop.com/samples/coverFlowcomponent/sampleapp/" target="_blank"><img class="alignnone size-full wp-image-28" title="sebcoverflow" src="http://www.sebastiaanholtrop.com/wp-content/sebcoverflow.jpg" alt="SebCoverFlow component for Flex" width="500" height="238" /></a></p>
<p>A lot of things have changed under the hood, a lot of bugs are fixed and you have to use the component a bit different.</p>
<ul>
<li>The previous version was built as a container, the new version is built more like a dataGrid, so it&#8217;s a component with a dataProvider. The component just renders the data in the dataProvider</li>
<li>It&#8217;s dynamic! It loads the images from the dataProvider. Changes on the dataProvider will be detected through binding</li>
<li>It&#8217;s now compatible with the Flex history manager, I&#8217;ve implemented the IHistoryManagerClient interface</li>
<li>It&#8217;s now compatible with the Flex focus manager, I&#8217;ve implemented the IFocusManagerComponent interface</li>
<li>I&#8217;ve added keyboard control, so the left and right arrow keys change the selected cover</li>
<li>It dispatches events, it lets everyone who&#8217;s listening know that the selectedIndex has changed, that it&#8217;s finished animating, etc</li>
<li>It&#8217;s now properly masked, the 3d scene doesn&#8217;t stretch to the full stage width and height anymore</li>
<li>And some more other small things</li>
</ul>
<p>I&#8217;ve created a new sample project to demonstrate all of the features, <a title="Flex 2 CoverFlow component sample application" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/sampleapp/" target="_blank">see it in action here</a>. You can see and <a title="Source view of the coverFlow sample project" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/sampleapp/srcview/index.html">download the source code of the sample project here</a>.</p>
<p>The component free to download and free to use, <a title="Flex 2 CoverFlow component swc" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/SebCoverFlow.swc">download the swc here</a>. I&#8217;m not publishing the source code of this one for now.</p>
<p>I&#8217;ve created documentation to help you put this component to good use, <a title="Flex 2 CoverFlow component documentation" href="http://sebastiaanholtrop.com/samples/coverFlowcomponent/asdoc/com/sebastiaanholtrop/components/coverflow/SebCoverFlow.html">read it here</a>.</p>
<p>Let me know what you think of it. I&#8217;d also like to see some end results. some projects in which you&#8217;ve used my component.</p>
<p>The next step? Hmm, a <a title="Piclens" href="http://www.cooliris.com/">piclens </a>component perhaps?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/27/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>How to use ASDoc with external libraries</title>
		<link>http://www.sebastiaanholtrop.com/archives/25</link>
		<comments>http://www.sebastiaanholtrop.com/archives/25#comments</comments>
		<pubDate>Thu, 11 Sep 2008 18:57:09 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[ASDoc]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=25</guid>
		<description><![CDATA[Because documenting your code itself isn&#8217;t a really fun job you don&#8217;t want to spend to much time fiddling around with ASDoc as well, so here&#8217;s a short description of how you can generate the documentation simple and easy;
To conveniently call the asdoc.exe command from every folder on your system you have to add the [...]]]></description>
			<content:encoded><![CDATA[<p>Because documenting your code itself isn&#8217;t a really fun job you don&#8217;t want to spend to much time fiddling around with ASDoc as well, so here&#8217;s a short description of how you can generate the documentation simple and easy;</p>
<p>To conveniently call the asdoc.exe command from every folder on your system you have to add the path to the folder asdoc.exe is in to the PATH system variable. Here&#8217;s how: Go to your Control Panel and click System. Go to the Advanced tab and click Environment Variables. In the System Variables list locate the Path variable. If it doesn&#8217;t exist create it. Doubleclick the variable to edit the value and add the location of your Flex bin folder, in my case it is: &#8220;d:\Program Files\Adobe\Flex Builder 2\Flex SDK 2\bin&#8221;. Don&#8217;t replace any of the other values in the variable, the value of the variable is semicolon-separated, so just add the path at the end of the value. Now click OK OK and reboot. After the reboot you should be able to just enter this in the command line: c:\asdoc, and ASDoc should respond with a beautiful error.</p>
<p>I hate typing in a command prompt (I don&#8217;t like typing at all), so I create a batch file to call ASDoc so I can create and recreate my documentation again and again. I place the batch file in the root of my project, so here&#8217;s what my project looks like:</p>
<p><a href="http://www.sebastiaanholtrop.com/wp-content/exampleproject.jpg"><img class="alignleft size-full wp-image-26" title="Flex Library Project" src="http://www.sebastiaanholtrop.com/wp-content/exampleproject.jpg" alt="" width="204" height="193" /></a></p>

<div class="wp_codebox"><table><tr id="p2510"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p25code10"><pre class="actionscript" style="font-family:monospace;">asdoc -source-path . -doc-sources . -output asdoc -external-library-path=lib -main-title <span style="color: #ff0000;">&quot;My work API documentation&quot;</span> -window-title <span style="color: #ff0000;">&quot;My work API documentation&quot;</span></pre></td></tr></table></div>

<p>Some explanation about the switches in this command:</p>
<ul>
<li> asdoc: this calls the asdoc command</li>
<li>-source-path: Enter a dot to tell ASDoc that the current folder is the source path</li>
<li>-doc-sources: Enter a dot to tell ASDoc to document all of the sources in the current Folder</li>
<li>-output asdoc: This is the name of the Folder in which the documentation will be generated</li>
<li> -external-library-path: If you use external swc&#8217;s, ASDoc wants to know about them, so enter the Folder in which they are located. In my project above I&#8217;ve used Away3D and Tweener, they are located in the lib folder</li>
<li>-main-title: The title at the top of the document</li>
<li>-window-title: The title the browser window displays</li>
</ul>
<p>Note that the -external-library-path is an undocumented switch, I&#8217;ve spent an hour to get ASDoc to work properly with external libraries. Using -library-path won&#8217;t work, you&#8217;ll replace the Flex Framework by doing that, so ASDoc will say something like &#8220;Hey, what&#8217;s a UIComponent?&#8221;.</p>
<p>Everything should work fine, but with ASDoc you&#8217;re never sure. Just run the batch file from the command line and see what happens.</p>
<p>By the way: don&#8217;t use unsupported tags in your code. The @description tag for instance is not supported, which will result in ASDoc throwing a useless xml parser error.</p>
<p>Good luck, you&#8217;re on your own now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/25/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flex CoverFlow Component updated</title>
		<link>http://www.sebastiaanholtrop.com/archives/19</link>
		<comments>http://www.sebastiaanholtrop.com/archives/19#comments</comments>
		<pubDate>Wed, 11 Jun 2008 19:10:30 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>
		<category><![CDATA[CoverFlow]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=19</guid>
		<description><![CDATA[There&#8217;s a project page of this component now, check it here, it&#8217;s open source!

I&#8217;ve been quite busy working on my CoverFlow component. I&#8217;ve added my reflection class and added the possibility to use cubes instead of planes as a cover. Since I&#8217;ve used a true 3D engine (Away3D) to build this component it&#8217;s become much [...]]]></description>
			<content:encoded><![CDATA[<p><a title="SebCoverflow Project page" href="http://www.sebastiaanholtrop.com/sebcoverflowprojectpage" target="_self">There&#8217;s a project page of this component now, check it here, it&#8217;s open source!<br />
</a></p>
<p>I&#8217;ve been quite busy working on my CoverFlow component. I&#8217;ve added my <a title="Reflection class" href="http://www.sebastiaanholtrop.com/archives/17" target="_blank">reflection class</a> and added the possibility to use cubes instead of planes as a cover. Since I&#8217;ve used a true 3D engine (<a title="Away3D" href="http://away3d.com/" target="_blank">Away3D</a>) to build this component it&#8217;s become much more than just a CoverFlow rip-off. Here are some examples of what it can do:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/covercube/"><img class="alignnone size-full wp-image-20" title="CoverCube Example" src="http://www.sebastiaanholtrop.com/wp-content/covercubenewexample1.jpg" alt="CoverCube Example" width="500" height="193" /></a></p>
<p><a href="http://www.sebastiaanholtrop.com/samples/covercube/"><img class="alignnone size-full wp-image-21" title="CoverCube example" src="http://www.sebastiaanholtrop.com/wp-content/covercubenewexample2.jpg" alt="CoverCube example" width="500" height="193" /></a></p>
<p><a title="CoverCube" href="http://www.sebastiaanholtrop.com/samples/covercube/">Click here to see the CoverCube in action</a>. Try the presets and drag the sliders to explore the possibilities of this component.<br />
<a title="Covercube source code" href="http://www.sebastiaanholtrop.com/samples/covercube/srcview/index.html">Click here to view the source code.</a></p>
<p>Here&#8217;s a few examples of the component using just planes:</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflowv2/"><img class="alignnone size-full wp-image-22" title="CoverFlow example" src="http://www.sebastiaanholtrop.com/wp-content/coverflownewexample.jpg" alt="CoverFlow example" width="500" height="193" /></a></p>
<p><a href="http://www.sebastiaanholtrop.com/samples/coverflowv2/"><img class="alignnone size-full wp-image-23" title="CoverFlow example" src="http://www.sebastiaanholtrop.com/wp-content/coverflownewexample2.jpg" alt="CoverFlow example" width="500" height="193" /></a></p>
<p><a title="CoverFlow V2" href="http://www.sebastiaanholtrop.com/samples/coverflowv2/">Click here to see the CoverFlowV2 in action</a>. Try the presets and drag the sliders to explore the possibilities of this component.<br />
<a title="CoverFlowV2 source code" href="http://www.sebastiaanholtrop.com/samples/coverflowv2/srcview/index.html">Click here to view the source code.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/19/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Flex Reflections Component and Actionscript Class</title>
		<link>http://www.sebastiaanholtrop.com/archives/17</link>
		<comments>http://www.sebastiaanholtrop.com/archives/17#comments</comments>
		<pubDate>Wed, 28 May 2008 21:46:02 +0000</pubDate>
		<dc:creator>Sebastiaan</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Adobe Flex 2]]></category>
		<category><![CDATA[Away3D]]></category>

		<guid isPermaLink="false">http://www.sebastiaanholtrop.com/?p=17</guid>
		<description><![CDATA[There are a lot of Reflection classes around, but I always enjoy writing my own. I had a special purpose in mind with writing this one; I wanted to create a reflection of a displayObject as a BitmapData, so I could use it as a Material in Away3D or any other actionscript 3D API. One [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of Reflection classes around, but I always enjoy writing my own. I had a special purpose in mind with writing this one; I wanted to create a reflection of a displayObject as a BitmapData, so I could use it as a Material in Away3D or any other actionscript 3D API. One thing led to another, and before I knew I was writing a Reflection Flex component as well.</p>
<p>So the idea is that there are two flavors to this Reflection classes:</p>
<ul>
<li>The Actionscript-only way to create a Reflection</li>
<li>The MXML-only way to create a Reflection</li>
</ul>
<p>I also wanted to be able to create a reflection of a video or any other moving object. Check the example to see it in action.</p>
<p><a href="http://www.sebastiaanholtrop.com/samples/reflections/" target="_blank"><img class="alignnone size-medium wp-image-18" title="reflectionexample" src="http://www.sebastiaanholtrop.com/wp-content/reflectionexample-300x291.jpg" alt="An image with reflection using Actionscript and or Flex" width="300" height="291" /></a></p>
<h2>The Actionscript-only way to create a Reflection</h2>
<p>I&#8217;ve created this one so you can create reflections in Flash or in any Actionscript project. I&#8217;m going to use this to create reflection BitmapData&#8217;s to use in Away3D. Here&#8217;s how you use it:</p>

<div class="wp_codebox"><table><tr id="p1713"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p17code13"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> reflection:Reflect = <span style="color: #000000; font-weight: bold;">new</span> Reflect<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">image1</span> as Sprite, <span style="color: #cc66cc;">0.4</span>, <span style="color: #cc66cc;">100</span>, <span style="color: #000000; font-weight: bold;">true</span>, Reflect.<span style="color: #006600;">BOTTOM</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>The constructor arguments are:</p>
<ul>
<li>The sprite to reflect</li>
<li>the alpha value</li>
<li>the ratio value</li>
<li>a boolean to tell if it should be added as a child to the target sprite</li>
<li>the direction of the reflection</li>
<li>the updateTime, this one is set to 0, so it doesn&#8217;t periodically update the reflection</li>
</ul>
<p>See the example <a title="Reflections sample" href="http://www.sebastiaanholtrop.com/samples/reflections/" target="_blank">here<br />
</a>See the sourcecode <a title="Reflections sample sourcecode" href="http://www.sebastiaanholtrop.com/samples/reflections/srcview/index.html" target="_blank">here</a></p>
<h2>The MXML-only way to create a Reflection</h2>
<p>The component version uses exactly the same arguments as the Actionscript class. All properties (except for the updateTime) are bindable, so you can alter the alpha, ratio, etc at runtime.</p>

<div class="wp_codebox"><table><tr id="p1714"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p17code14"><pre class="xml" style="font-family:monospace;">&nbsp;</pre></td></tr></table></div>

<p>See the example <a title="Reflections sample" href="http://www.sebastiaanholtrop.com/samples/reflections/" target="_blank">here<br />
</a>See the sourcecode <a title="Reflections sample sourcecode" href="http://www.sebastiaanholtrop.com/samples/reflections/srcview/index.html" target="_blank">here</a></p>
<p>There&#8217;s one problem with reflecting dynamic textfields. I&#8217;m using a Matrix to create the Flipped BitmapData. Unfortunately the scale and translate methods of the Matrix mess up the rendering of dynamic textfields, but hey, who would want to reflect a boring textfield or dateChooser <img src='http://www.sebastiaanholtrop.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
I&#8217;ve written a post about this problem, you can read it <a title="BitmapData and Matrix weirdness" href="http://www.sebastiaanholtrop.com/archives/16" target="_self">here</a>. I know the solution to this problem; Use a Bitmap and set the scaleY property, but this will only flip the Bitmap, the BitmapData is still not flipped, and as I mentioned before, this was all to do about the Flipped and reflected BitmapData.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastiaanholtrop.com/archives/17/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
