<?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>adambergman.com</title>
	<atom:link href="http://www.adambergman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.adambergman.com</link>
	<description>dev blog — all things flex, flash, php and more</description>
	<lastBuildDate>Fri, 14 May 2010 05:55:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Portfolio Source Code Updated</title>
		<link>http://www.adambergman.com/2010/05/14/portfolio-source-code-updated/</link>
		<comments>http://www.adambergman.com/2010/05/14/portfolio-source-code-updated/#comments</comments>
		<pubDate>Fri, 14 May 2010 05:52:40 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex 4 Framework]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[flex 4]]></category>
		<category><![CDATA[PaperVision 3D]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=175</guid>
		<description><![CDATA[I spent the night updating the source code to my portfolio project.  This new version is broken out into a much easier to understand architecture than the previous version.  I have also went through and commented a lot of the functionality, but at some point I would like to go back and make sure I [...]]]></description>
			<content:encoded><![CDATA[<p>I spent the night updating the source code to my portfolio project.  This new version is broken out into a much easier to understand architecture than the previous version.  I have also went through and commented a lot of the functionality, but at some point I would like to go back and make sure I hit every function.  This version contains stock images and information instead of the images used in <a href="http://adambergman.com/portfolio">my real portfolio</a>.  If you have any questions or comments I would love to hear them.</p>
<p><a href="http://adambergman.com/lab/portfolio/">View the Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2010/05/14/portfolio-source-code-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Portfolio Source Code Available</title>
		<link>http://www.adambergman.com/2009/12/14/portfolio-source-code-available/</link>
		<comments>http://www.adambergman.com/2009/12/14/portfolio-source-code-available/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 20:57:22 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PaperVision 3D]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=171</guid>
		<description><![CDATA[I have been receiving a lot of e-mails lately regarding the release of my portfolio source code.  I still haven&#8217;t had time to clean it up, but I have decided to just post it out here anyway.  There may be unused methods and classes and even some debug trace statements strewn about the code but [...]]]></description>
			<content:encoded><![CDATA[<p>I have been receiving a lot of e-mails lately regarding the release of <a href="http://www.adambergman.com/2009/10/07/portfolio-made-in-flex-4-with-papervision-3d/">my portfolio</a> source code.  I still haven&#8217;t had time to clean it up, but I have decided to just post it out here anyway.  There may be unused methods and classes and even some debug trace statements strewn about the code but I figure I shouldn&#8217;t make people wait any longer.  I only ask that you do not try to pass this off as your own work, please use the code as a guide for your projects, not as your project.  I do plan on eventually cleaning this up, I&#8217;ll post that when I get around to actually doing it. Until then, enjoy!  If you have any questions please post them as a comment and I will do my best to answer them.</p>
<p><a href="http://www.adambergman.com/lab/portfolio/" target="_blank">View my Portfolio Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/12/14/portfolio-source-code-available/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Portfolio made in Flex 4 with Papervision 3D</title>
		<link>http://www.adambergman.com/2009/10/07/portfolio-made-in-flex-4-with-papervision-3d/</link>
		<comments>http://www.adambergman.com/2009/10/07/portfolio-made-in-flex-4-with-papervision-3d/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 13:37:22 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4 Framework]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[PaperVision 3D]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[flex 4]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=164</guid>
		<description><![CDATA[A few weeks ago I posted my online portfolio.  I casually tweeted about it and mentioned it to some friends on Facebook.  After some tweeks, I&#8217;ve decided to post it on my blog for the world to see.  I&#8217;d like to eventually make the source code available, but it will definitely require [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I posted my online portfolio.  I casually tweeted about it and mentioned it to some friends on Facebook.  After some tweeks, I&#8217;ve decided to post it on my blog for the world to see.  I&#8217;d like to eventually make the source code available, but it will definitely require some cleanup as the entire thing &#8211; code, content, and all &#8211; was developed in about 24 hours over a rainy weekend.  Papervision is used to create the 3D space and the Tweener libraries are used to move the camera and objects around.  This is the first Flex 4 project I&#8217;ve tried to use Papervision with and I&#8217;ve got to say it was just as easy as it is with Flex 3.  The content is loaded via an XML file which makes it extremely easy to add screenshots and new projects.</p>
<p><a href="http://www.adambergman.com/portfolio/">http://www.adambergman.com/portfolio/</a></p>
<p style="text-align: center;"><img class="aligncenter" title="Portfolio" src="http://www.adambergman.com/media/portfolio.png" alt="" width="729" height="511" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/10/07/portfolio-made-in-flex-4-with-papervision-3d/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PagedLayout Part 3: Flickr Mashup</title>
		<link>http://www.adambergman.com/2009/09/18/pagedlayout-part-3-flickr-mashup/</link>
		<comments>http://www.adambergman.com/2009/09/18/pagedlayout-part-3-flickr-mashup/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 13:26:34 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4 Framework]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[flex 4]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=143</guid>
		<description><![CDATA[Over the last few days I have been posting about my first custom layout in the Spark component architecture, PagedLayout (day 1, day 2).  Today I thought I&#8217;d post a real world mashup using the layout as well as take a little more time to explain what&#8217;s going on with the class and how you [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last few days I have been posting about my first custom layout in the Spark component architecture, PagedLayout (<a href="http://www.adambergman.com/2009/09/16/flex-4-gumbo-custom-spark-layout-paged-layout/">day 1</a>,<a href="http://www.adambergman.com/2009/09/17/flex-4-gumbo-custom-spark-layout-animated-paged-layout/"> day 2</a>).  Today I thought I&#8217;d post a real world mashup using the layout as well as take a little more time to explain what&#8217;s going on with the class and how you can use it in your projects.  Since I didn&#8217;t have time yesterday to post the changes I made between the animated and non-animated versions I&#8217;ll go through them now.</p>
<p>I am using the <a href="http://blog.greensock.com/tweenliteas3/" target="_blank">GreenSock TweenLite</a> libraries to animate the transitions between pages.  The layout allows you to specify three key properties to manage the animation without having to modify the underlying layout class.  Notice these lines in the Flickr mashup:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="coMULTI">&lt;!&#8211; Our DataGroup bound to our itemList data provider with the Paged Layout applied &#8211;&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:DataGroup</span> id=<span class="st0">&quot;datagroup&quot;</span> height=<span class="st0">&quot;128&quot;</span> verticalCenter=<span class="st0">&quot;-1&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&nbsp; &nbsp; &nbsp; &nbsp; dataProvider=<span class="st0">&quot;{photoFeed}&quot;</span> itemRenderer=<span class="st0">&quot;itemRenderer&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&nbsp; &nbsp; &nbsp; &nbsp; width=<span class="st0">&quot;446&quot;</span> horizontalCenter=<span class="st0">&quot;2&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:layout</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;adam:PagedLayout</span> id=<span class="st0">&quot;myLayout&quot;</span> itemPadding=<span class="st0">&quot;10&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; animationDuration=<span class="st0">&quot;0.75&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; easingType=<span class="st0">&quot;{PagedLayout.EASING_DEFAULT}&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; useAnimation=<span class="st0">&quot;true&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:layout</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/s:DataGroup</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p>PagedLayout allows you to specify whether or not it uses animation to switch between pages with the useAnimation property.  You can set this property to true or false.  </p>
<p>The animationDuration property is the number of seconds it takes the transition to complete.  </p>
<p>The easingType property is  a string place holder for the type of easing you wish to use in the animation.  There is currently support for Elastic, Bounce, Quadratic, and Cubic &#8211; the respective constants are EASING_ELASTIC, EASING_BOUNCE, EASING_DEFAULT, and EASING_CUBIC.  Take a quick look at the PagedLayout.as class file and you can see how easy it is to add a new type of easing as an option.  All easing included with TweenLite is supported, just use what is already there as an example and it should take only a few seconds to add in other easing equations.</p>
<p>I used the same method as <a href="http://evtimmy.com/" target="_blank">Evtim</a> in his <a href="http://evtimmy.com/2009/06/wheellayout-source-and-quick-mashup/" target="_blank">WheelLayout Mashup</a> post to connect with Flickr.  This method downloads up to 20 photos from Flickr&#8217;s recent uploads RSS feed to use them as elements in the layout.  Below is the final version with a link to view it in a full browser window and a direct link to the source code.  As always, free for personal use, and commercial use (if you <a href="/about/">drop me an e-mail</a>).</p>
<p><a href="http://www.adambergman.com/lab/flickrslider/" target="_blank">View the Project in Action</a><br />
<a href="http://www.adambergman.com/lab/flickrslider/srcview/index.html" target="_blank">Explore the Source Code</a></p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FlickrSlider_1666384841"
			class="flashmovie"
			width="650"
			height="200">
	<param name="movie" value="http://www.adambergman.com/lab/flickrslider/FlickrSlider.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.adambergman.com/lab/flickrslider/FlickrSlider.swf"
			name="fm_FlickrSlider_1666384841"
			width="650"
			height="200">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/09/18/pagedlayout-part-3-flickr-mashup/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Flex 4 Gumbo Custom Spark Layout: Animated Paged Layout</title>
		<link>http://www.adambergman.com/2009/09/17/flex-4-gumbo-custom-spark-layout-animated-paged-layout/</link>
		<comments>http://www.adambergman.com/2009/09/17/flex-4-gumbo-custom-spark-layout-animated-paged-layout/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 20:08:27 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4 Framework]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[flex 4]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=137</guid>
		<description><![CDATA[Update: For the final version of the PagedLayout source, please visit Part 3.
Yesterday I posted my first attempt at a custom Spark Layout, PagedLayout.  Using the GreenSock TweenLite libraries I added animation to the transitions of pages.  I will go into detail on the changes made to the original class at some point, but today [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> For the final version of the PagedLayout source, <a href="http://www.adambergman.com/2009/09/18/pagedlayout-part-3-flickr-mashup/">please visit Part 3</a>.</p>
<p>Yesterday I posted <a href="http://www.adambergman.com/2009/09/16/flex-4-gumbo-custom-spark-layout-paged-layout/">my first attempt at a custom Spark Layout, PagedLayout</a>.  Using the <a href="http://blog.greensock.com/tweenliteas3/" target="_blank">GreenSock TweenLite libraries</a> I added animation to the transitions of pages.  I will go into detail on the changes made to the original class at some point, but today I only have time to post the project and my source.  I have also created a an example application using Flickr&#8217;s RSS feed that I will post tomorrow.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_PagedLayoutApp_395724770"
			class="flashmovie"
			width="650"
			height="365">
	<param name="movie" value="http://www.adambergman.com/lab/pagedlayoutanimated/PagedLayoutApp.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.adambergman.com/lab/pagedlayoutanimated/PagedLayoutApp.swf"
			name="fm_PagedLayoutApp_395724770"
			width="650"
			height="365">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img style="border: 0px initial initial;" src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><a href="http://www.adambergman.com/lab/pagedlayoutanimated/" target="_blank">View the Project in Action</a><br />
<a href="http://www.adambergman.com/lab/pagedlayoutanimated/srcview/index.html" target="_blank">Explore the Source Code</a></p>
<p>You may notice I didn&#8217;t go through and remove unnecessary parts of the tweening libraries, that&#8217;s something I&#8217;ll do later on as well.</p>
<p>Also, there are bugs in Flash Builder 4 (Gumbo) that prevent leading ['s (in cases like [Bindable]) from showing up in the exported source.  Make sure you download the zip file if you plan on using this code, not copying and pasting from the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/09/17/flex-4-gumbo-custom-spark-layout-animated-paged-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex 4 Gumbo Custom Spark Layout: Paged Layout</title>
		<link>http://www.adambergman.com/2009/09/16/flex-4-gumbo-custom-spark-layout-paged-layout/</link>
		<comments>http://www.adambergman.com/2009/09/16/flex-4-gumbo-custom-spark-layout-paged-layout/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 14:21:20 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4 Framework]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[flex 4]]></category>
		<category><![CDATA[LayoutBase]]></category>
		<category><![CDATA[layouts]]></category>
		<category><![CDATA[spark]]></category>
		<category><![CDATA[spark layouts]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=129</guid>
		<description><![CDATA[Update: For the final version of the PagedLayout source, please visit Part 3.
I am intrigued by the possibilities of the new layout architecture in the Flex 4 framework (currently in beta, code named Gumbo).  I have seen some really neat stuff materializing already: Evtim&#8217;s WheelLayout and FlowLayout, Andrew Trice&#8217;s CircularLayout, and Ryan Campbell&#8217;s collection of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> For the final version of the PagedLayout source, <a href="http://www.adambergman.com/2009/09/18/pagedlayout-part-3-flickr-mashup/">please visit Part 3</a>.</p>
<p>I am intrigued by the possibilities of the new layout architecture in the Flex 4 framework (currently in beta, code named Gumbo).  I have seen some really neat stuff materializing already: <a href="http://evtimmy.com/2009/06/wheellayout-source-and-quick-mashup/" target="_blank">Evtim&#8217;s WheelLayout</a> and <a href="http://evtimmy.com/2009/06/flowlayout-a-spark-custom-layout-example/" target="_blank">FlowLayout</a>, <a href="http://www.insideria.com/2009/05/flex-4-custom-layouts.html" target="_blank">Andrew Trice&#8217;s CircularLayout</a>, and <a href="http://www.ryancampbell.com/2009/06/16/heres-5-3d-layouts-for-flex-4/" target="_blank">Ryan Campbell&#8217;s collection of 3D Layouts</a>.</p>
<p>Inspired by the great Javascript widgets on <a href="http://www.apple.com/getamac/ads/" target="_blank">Apple&#8217;s Get A Mac</a> web page and <a href="http://fastflip.googlelabs.com/" target="_blank">Google&#8217;s new Fast Flip</a>, I decided to get my feet wet with Flex layouts.  This layout is similar to a horizontal layout in that it positions children from left to right along the same Y-axis.  It differs in that it compares the width of child elements on the container and when the combined of width of the child elements exceeds the width of the container it creates a new &#8220;page&#8221; for the extra elements.</p>
<p>Since this is my first experience with the new layout architecture I&#8217;m not sure if I&#8217;m doing everything to protocol &#8211; that is to say, it works, but is it the most optimal way to do it?  Thoughts, opinions, ideas, and criticism is desired.  I have 3 iterations of this layout and I&#8217;ll be posting one each day.  The first contains no animation, it is simply layout logic with some convenience methods for moving between pages.  Which leads me to my first question &#8211; Is it appropriate to have methods that modify the layout inside of the custom layout class?  I couldn&#8217;t really think of another way to do it so my next() and previous() paging functions are included in the actual layout class.</p>
<p>Below is the movie, you can view the source by right-clicking and going to &#8220;View Source&#8221;.  I have also linked the project so you can view it in a full browser window and really get a feel for the container in larger screen dimensions.  Tomorrow I&#8217;ll be posting the animated version.</p>
<p>In this version there are 15 buttons added to a DataContainer on startup.  You can use the sliders to control the container&#8217;s width and the padding between buttons.  The current page number and number of pages is displayed below.  Use the &#8220;Prev&#8221; and &#8220;Next&#8221; buttons to move between pages.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_PagedLayoutApp_1897897468"
			class="flashmovie"
			width="650"
			height="365">
	<param name="movie" value="http://www.adambergman.com/lab/pagedlayout/PagedLayoutApp.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.adambergman.com/lab/pagedlayout/PagedLayoutApp.swf"
			name="fm_PagedLayoutApp_1897897468"
			width="650"
			height="365">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><a href="http://www.adambergman.com/lab/pagedlayout/">View the Project in Action</a><br />
<a href="http://www.adambergman.com/lab/pagedlayout/srcview/index.html" target="_blank">Explore the Source Code </a></p>
<p>As with most code I post, feel free to use this code in your personal projects.  If you do wish to use this in a commercial project you are free to do so as long as you drop me line and let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/09/16/flex-4-gumbo-custom-spark-layout-paged-layout/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac Style Button Skin for Flash Builder 4 (Flex Gumbo)</title>
		<link>http://www.adambergman.com/2009/09/15/mac-style-button-skin-for-flash-builder-4-flex-gumbo/</link>
		<comments>http://www.adambergman.com/2009/09/15/mac-style-button-skin-for-flash-builder-4-flex-gumbo/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 12:59:34 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[flex 4]]></category>
		<category><![CDATA[Skin]]></category>
		<category><![CDATA[States]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=112</guid>
		<description><![CDATA[I had to create some mock-ups for a project the other day and I did a quick skin of a button that I thought  I&#8217;d share. Thanks to Zach O. for the graphic assets.  Feel free to use this in any projects, personal or commercial, I just ask that you send me an e-mail and [...]]]></description>
			<content:encoded><![CDATA[<p>I had to create some mock-ups for a project the other day and I did a quick skin of a button that I thought  I&#8217;d share. Thanks to <a href="http://twitter.com/odedvard" target="_blank">Zach O.</a> for the graphic assets.  Feel free to use this in any projects, personal or commercial, I just ask that you <a href="http://www.adambergman.com/about/" target="_self">send me an e-mail</a> and let me know that you got some use out of it.  This button is a good example of using Scale 9 and embedding assets in a Flex 4 skin file.  In the Skin component file of type <span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #2c26f9; ">&lt;s:Skin&gt;<span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "> I have 4 <span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #2c26f9; ">&lt;s:BitmapImage&gt;<span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "> tags.  Each tag is displayed on one of the four states: up, down, over, and disabled.  The tag <span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #2c26f9; "><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; ">uses the <span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #a90e0c; ">@Embed <span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; ">syntax to set its <span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; ">source<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "> property.   The scale 9 information is also set in this line:</span></span></span></span></span></span></span></span></span></span></p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:BitmapImage</span> left=<span class="st0">&quot;0&quot;</span> right=<span class="st0">&quot;0&quot;</span> top=<span class="st0">&quot;0&quot;</span> bottom=<span class="st0">&quot;0&quot;</span> source=<span class="st0">&quot;@Embed(&#8216;assets/button_up.png&#8217;, scaleGridTop=&#8217;13&#8242;, scaleGridLeft=&#8217;12&#8242;, scaleGridRight=&#8217;68&#8242;, scaleGridBottom=&#8217;14&#8242;)&quot;</span> resizeMode=<span class="st0">&quot;scale&quot;</span> includeIn=<span class="st0">&quot;up&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p>Also notice the <span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; ">includeIn <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; ">property, this tells the player which state the image is visible in.  Below are a few screen shots of the buttons along with links to the example project and source code.</span></span></p>
<p><span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; "><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "><a href="http://www.adambergman.com/lab/macbutton/" target="_blank">View the Project in Action</a><br />
<a href="http://www.adambergman.com/lab/macbutton/srcview/index.html" target="_blank">View and Download the Source Code </a></span></span></p>
<p style="text-align: center;"><span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; "><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "><img class="aligncenter" src="http://www.adambergman.com/media/macbuttonss2.png" alt="" width="143" height="33" /></span></span></p>
<p style="text-align: center;"><span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; "><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "><img class="aligncenter" src="http://www.adambergman.com/media/macbuttonss.png" alt="" width="554" height="434" /></span></span></p>
<p><span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #2c26f9; "><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "><span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #2c26f9; "><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; "><span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; color: #2c26f9; "><br />
</span></span></span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/09/15/mac-style-button-skin-for-flash-builder-4-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Flex 4 (Gumbo) Skinning with States and Animation</title>
		<link>http://www.adambergman.com/2009/06/28/flex-4-gumbo-skinning-with-states-and-animation/</link>
		<comments>http://www.adambergman.com/2009/06/28/flex-4-gumbo-skinning-with-states-and-animation/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 06:37:03 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[AnimateColor]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[flex 4]]></category>
		<category><![CDATA[Skin]]></category>
		<category><![CDATA[SkinnableContainer]]></category>
		<category><![CDATA[States]]></category>
		<category><![CDATA[Transitions]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=79</guid>
		<description><![CDATA[Yesterday, I wanted to get a feel for how skinning was changing in the new Flex 4 framework.  I thought Catalyst was going to be the best route, but after staring at a blank artboard in Illustrator for a few minutes I decided it might be good to just code some things by hand [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I wanted to get a feel for how skinning was changing in the new Flex 4 framework.  I thought Catalyst was going to be the best route, but after staring at a blank artboard in Illustrator for a few minutes I decided it might be good to just code some things by hand see what materialized.  I checked out the documentation and thought an easy exercise in skinning would be to recreate the old ApplicationControlBar in the Flex 2/3 framework.  This seemed like a good job for <span style="font-family: Courier New;">SkinnableContainer</span>.  A step by step is available after the jump.</p>
<p><a href="http://adambergman.com/lab/skinbar/" target="_blank">View the Project in Action</a><br />
<a href="http://adambergman.com/lab/skinbar/srcview/" target="_blank">Explore the Source Code</a><br />
<a href="http://adambergman.com/2009/06/28/flex-4-gumbo-skinning-with-states-and-animation/">Step By Step Explanation</a></p>
<p><img src="http://www.adambergman.com/wp-content/uploads/2009/06/picture-1.png" alt="Application Control Bar Final" title="Application Control Bar Final" width="505" height="174" class="alignnone size-full wp-image-81" /></p>
<p><span id="more-79"></span></p>
<p><strong>Step 1: Photoshop</strong></p>
<p>I knew that I wanted to be able to change the bar&#8217;s color, and that I wanted that to animate with the <span style="font-family: Courier New;">AnimateColor</span> transition.  I also knew that I wanted the bar to have a glossy feel to it.  So, I fired up Photoshop and mocked up my new application bar:</p>
<p><img class="alignnone size-full wp-image-80" title="ApplicationControlBar mockup" src="http://www.adambergman.com/wp-content/uploads/2009/06/picture-3.png" alt="ApplicationControlBar mockup" width="421" height="275" /></p>
<p>I added the highlights on separate layers so I could isolate them, create a pattern and then use them in a <span style="font-family: Courier New;">BitmapFill</span> on the skin of my bar.  Below is a screenshot of the highlight pattern on a black background:</p>
<p><img class="alignnone size-full wp-image-82" title="Application Control Bar Highlight" src="http://www.adambergman.com/wp-content/uploads/2009/06/picture-2.png" alt="Application Control Bar Highlight" width="421" height="275" /></p>
<p>I exported my highlights with no background layer to a PNG file (to preserve the transparency) and fired up Flash Builder 4 Beta.  </p>
<p><strong>MXML Application in Flash Builder</strong></p>
<p>First I created a new project called &#8220;SkinBar&#8221; and dropped a <span style="font-family: Courier New;">SkinnableContainer</span> on to the blank canvas (MXML below):</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:Application</span> xmlns:fx=<span class="st0">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"> &nbsp; &nbsp; &nbsp;xmlns:s=<span class="st0">&quot;library://ns.adobe.com/flex/spark&quot;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"> &nbsp; &nbsp; &nbsp;xmlns:mx=<span class="st0">&quot;library://ns.adobe.com/flex/halo&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:SkinnableContainer</span> height=<span class="st0">&quot;33&quot;</span> left=<span class="st0">&quot;0&quot;</span> right=<span class="st0">&quot;0&quot;</span> top=<span class="st0">&quot;0&quot;</span> id=<span class="st0">&quot;bar&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:SkinnableContainer</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/s:Application</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p><strong>Creating a Skin</strong></p>
<p>The background skin of my <span style="font-family: Courier New;">SkinnableContainer</span> would include two rectangles, the bottom-most would have a standard <span style="font-family: Courier New;">SolidColor</span> fill and the top-most rectangle would have a BitmapFill that used my highlights image as a pattern.  I want the background rectangle to be able to switch between green, red and blue.  First, I create a new MXML Component and base it on the <span style="font-family: Courier New;">Skin</span> component.  I call it &#8220;ApplicationBarBackground&#8221;:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3">&lt;?xml version=<span class="st0">&quot;1.0&quot;</span> encoding=<span class="st0">&quot;utf-8&quot;</span>?<span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:Skin</span> &nbsp;xmlns:fx=<span class="st0">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xmlns:s=<span class="st0">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xmlns:mx=<span class="st0">&quot;library://ns.adobe.com/flex/halo&quot;</span> </span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;height=<span class="st0">&quot;33&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;fx:Metadata</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; [HostComponent(&quot;spark.components.SkinnableContainer&quot;)]</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/fx:Metadata</span><span class="re2">&gt;</span></span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:states</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;normal&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;disabled&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:states</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:layout</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:BasicLayout</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:layout</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:Group</span> id=<span class="st0">&quot;contentGroup&quot;</span> left=<span class="st0">&quot;5&quot;</span> right=<span class="st0">&quot;5&quot;</span> top=<span class="st0">&quot;5&quot;</span> bottom=<span class="st0">&quot;5&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:layout</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:HorizontalLayout</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:layout</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:Group</span><span class="re2">&gt;</span></span> &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/s:Skin</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p>The component starts out with the <span style="font-family: Courier New;">&lt;fx:Metadata&gt;</span> tag.  This tag tells the compiler which component type the skin is used with.  The tag is very important in that it gives us the ability to call back to the root component&#8217;s data/model from our skin class.  Most of the time you wouldn&#8217;t need this functionality because things like disabled/enabled, selected/not are handled with states.</p>
<p>The <span style="font-family: Courier New;">SkinnableContainer</span> component requires at least two specific states to be implemented in the <span style="font-family: Courier New;">Skin</span>, &#8220;normal&#8221; and &#8220;disabled&#8221;.  If you try to compile the <span style="font-family: Courier New;">Skin</span> without these two states the compiler will throw an error.  Beyond the states required by the component you are skinning you can specify other, custom states.  We&#8217;ll look at this in a bit.</p>
<p>After the <span style="font-family: Courier New;">&lt;s:states&gt;</span> tag comes the <span style="font-family: Courier New;">&lt;s:layout&gt;</span> tag.  This property specifies how the <span style="font-family: Courier New;">SkinnableContainer</span> component will display its children.  <span style="font-family: Courier New;">BasicLayout</span> works fine here because I will be manually setting the position of the children.</p>
<p>Finally, you see the<span style="font-family: Courier New;"> &lt;s:Group&gt;</span> tag which is the actual container for components that are added to the <span style="font-family: Courier New;">SkinnableContainer</span> using the <span style="font-family: Courier New;">addChild()</span> or <span style="font-family: Courier New;">addChildAt()</span> methods.  A container is required here and it must be named &#8220;contentGroup&#8221;.  Not including this will result in a compiler error.  Because I want the container to behave like the ApplicationControlBar I have told the group to use a <span style="font-family: Courier New;">HorizontalLayout</span>.</p>
<p><strong>Adding Custom Graphical Elements</strong></p>
<p>We currently have a good skeleton of a skin going, it complies with the structure for a <span style="font-family: Courier New;">SkinnableContainer</span>.  Now, we have to customize it.  I&#8217;ll do that by first adding my visual elements: two rectangles, one a solid color, the other my highlight pattern.</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:Rect</span> height=<span class="st0">&quot;33&quot;</span> top=<span class="st0">&quot;0&quot;</span> right=<span class="st0">&quot;0&quot;</span> left=<span class="st0">&quot;0&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:fill</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;mx:SolidColor</span> id=<span class="st0">&quot;barColor&quot;</span> color=<span class="st0">&quot;0&#215;608e34&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:fill</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;/s:Rect</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;s:Rect</span> height=<span class="st0">&quot;33&quot;</span> top=<span class="st0">&quot;0&quot;</span> right=<span class="st0">&quot;0&quot;</span> left=<span class="st0">&quot;0&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:fill</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:BitmapFill</span> source=<span class="st0">&quot;@Embed(&#8216;bar_highlight.png&#8217;)&quot;</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:fill</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;/s:Rect</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p>In MXML, the top most component in the MXML syntax is rendered first and therefore &#8220;below&#8221; other components that come after it in MXML syntax.  First, we create a rectangle and set its fill to a solid color.  Notice that an id of &#8220;barColor&#8221; is given to the fill so that we can animate its properties during transitions.  The second <span style="font-family: Courier New;">&lt;s:Rect&gt;</span> tag has the same dimensions as the first, however it contains a <span style="font-family: Courier New;">BitmapFill</span> which will repeat the highlight pattern I created in Photoshop earlier.</p>
<p><strong>Declaring the Skin in your Application</strong></p>
<p>The last thing you must do to use a new skin is to set the <span style="font-family: Courier New;">skinClass</span> property on your <span style="font-family: Courier New;">SkinnableContainer</span>.  You can do this by either setting the property on the instance of the <span style="font-family: Courier New;">SkinnableContainer</span> in the MXML:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:SkinnableContainer</span> height=<span class="st0">&quot;33&quot;</span> left=<span class="st0">&quot;0&quot;</span> right=<span class="st0">&quot;0&quot;</span> top=<span class="st0">&quot;0&quot;</span> skinClass=<span class="st0">&quot;ApplicationBarBackground&quot;</span> id=<span class="st0">&quot;bar&quot;</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p>If you would like this skin to apply to all <span style="font-family: Courier New;">SkinnableContainers</span> in your application you could create a style:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;fx:Style</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s|SkinnableContainer {</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; skinClass: ClassReference(&quot;ApplicationBarBackground&quot;);&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/fx:Style</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p></p>
<p>After setting your <span style="font-family: Courier New;">SkinnableContainer</span>&#8217;s skinClass property, you should be able to compile and run the application and see a nice green skin.  Now we&#8217;ll add some new states and transitions.</p>
<p><strong>Custom States with Animated Transitions</strong></p>
<p>Three states are added to the <span style="font-family: Courier New;">Skin</span> MXML: &#8220;red&#8221;, &#8220;green&#8221;, and &#8220;blue&#8221;.  </p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:states</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;normal&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;disabled&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;green&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;red&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:State</span> name=<span class="st0">&quot;blue&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:states</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p>The <span style="font-family: Courier New;">color</span> property of our <span style="font-family: Courier New;">SolidFill</span> will be modified based on the state:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:Rect</span> height=<span class="st0">&quot;33&quot;</span> top=<span class="st0">&quot;0&quot;</span> right=<span class="st0">&quot;0&quot;</span> left=<span class="st0">&quot;0&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:fill</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;mx:SolidColor</span> id=<span class="st0">&quot;barColor&quot;</span> color.blue=<span class="st0">&quot;0&#215;003abc&quot;</span> color.green=<span class="st0">&quot;0&#215;608e34&quot;</span> color=<span class="st0">&quot;0&#215;608e34&quot;</span> color.red=<span class="st0">&quot;0&#215;8e3434&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:fill</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;/s:Rect</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/><br />
Notice the multiple definitions for the <span style="font-family: Courier New;">color</span> property &#8211; one for each state.  The default <span style="font-family: Courier New;">color=&#8221;&#8230;&#8221;</span> is used for the normal state.</p>
<p>This functionality can be tested by adding a <span style="font-family: Courier New;">Button</span> to the main <span style="font-family: Courier New;">Application</span> that switches the state of the <span style="font-family: Courier New;">Skin</span> on the <span style="font-family: Courier New;">SkinnableContainer</span>:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:Button</span> x=<span class="st0">&quot;554&quot;</span> y=<span class="st0">&quot;51&quot;</span> label=<span class="st0">&quot;Red&quot;</span> click=<span class="st0">&quot;bar.skin.currentState=&#8217;red&#8217;;&quot;</span><span class="re2">/&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p><strong>Transitions between States</strong><br />
To make the current color of the rectangle (inside our <span style="font-family: Courier New;">Skin</span> MXML) move smoothly to the color of the state that is going to be displayed I used the <span style="font-family: Courier New;">AnimateColor</span> transition:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;s:transitions</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:Transition</span> fromState=<span class="st0">&quot;*&quot;</span> toState=<span class="st0">&quot;*&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:AnimateColor</span> duration=<span class="st0">&quot;1000&quot;</span> target=<span class="st0">&quot;{barColor}&quot;</span> <span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:Transition</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/s:transitions</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p><br/></p>
<p>A duration is set to 1000 milliseconds, and the target of the animation is set to the <span style="font-family: Courier New;">fill</span> of the background rectangle.  </p>
<p><strong>On Demand Animations</strong></p>
<p>Finally, I added an animation that can be called through ActionScript:</p>
<div class="codesnip-container" >
<div class="mxml codesnip" style="font-family:monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;fx:Declarations</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;s:AnimateColor</span> target=<span class="st0">&quot;{barColor}&quot;</span> repeatBehavior=<span class="st0">&quot;reverse&quot;</span> duration=<span class="st0">&quot;520&quot;</span> colorTo=<span class="st0">&quot;0xFF0000&quot;</span> id=<span class="st0">&quot;flashRed&quot;</span> repeatCount=<span class="st0">&quot;6&quot;</span> <span class="re2">/&gt;</span></span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/fx:Declarations</span><span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
</div>
<p>This animation will flash the bar red 3 times and return back to the original color.  The final project can be viewed below:</p>
<p><a href="http://adambergman.com/lab/skinbar/" target="_blank">View the Project in Action</a><br />
<a href="http://adambergman.com/lab/skinbar/srcview/" target="_blank">Explore the Source Code</a></p>
<p><img src="http://www.adambergman.com/wp-content/uploads/2009/06/picture-1.png" alt="Application Control Bar Final" title="Application Control Bar Final" width="505" height="174" class="alignnone size-full wp-image-81" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/06/28/flex-4-gumbo-skinning-with-states-and-animation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PaperVision 3D Cubes Part 2</title>
		<link>http://www.adambergman.com/2009/06/02/papervision-3d-cubes-part-2/</link>
		<comments>http://www.adambergman.com/2009/06/02/papervision-3d-cubes-part-2/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 19:23:45 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PaperVision 3D]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=73</guid>
		<description><![CDATA[I have made some modifications to my cube experiment so I thought I&#8217;d share them.  In this version I have added Z support for the random position of cubes, as well as the &#8220;Chatoic&#8221; rotations and movements.  Using any of the normal rotate functions you will get a single rotation in Y, using a chaotic [...]]]></description>
			<content:encoded><![CDATA[<p>I have made some modifications to my cube experiment so I thought I&#8217;d share them.  In this version I have added Z support for the random position of cubes, as well as the &#8220;Chatoic&#8221; rotations and movements.  Using any of the normal rotate functions you will get a single rotation in Y, using a chaotic rotation will give you rotation on all 3 axies.  Of course the source is available for the taking.</p>
<p><a href="http://adambergman.com/lab/pv3dcubes2/" target="_blank">Check out the Project in Action</a><br />
<a href="http://www.adambergman.com/lab/pv3dcubes2/srcview/index.html" target="_blank">View the Source Code</a> (Update: I added some more descriptive comments to the source code)</p>
<p style="text-align: center;"><img class="size-full wp-image-74 aligncenter" title="cubes2" src="http://www.adambergman.com/wp-content/uploads/2009/06/cubes2.png" alt="cubes2" width="636" height="518" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/06/02/papervision-3d-cubes-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Application Background Gradients in Flash Builder 4 (Flex Gumbo)</title>
		<link>http://www.adambergman.com/2009/06/01/application-background-gradients-in-flash-builder-4-flex-gumbo/</link>
		<comments>http://www.adambergman.com/2009/06/01/application-background-gradients-in-flash-builder-4-flex-gumbo/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 20:11:14 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[background gradient]]></category>
		<category><![CDATA[flex 4]]></category>
		<category><![CDATA[lineargradient]]></category>

		<guid isPermaLink="false">http://www.adambergman.com/?p=67</guid>
		<description><![CDATA[I was playing around with the beta release of Flex Builder 4 (now called Flash Builder 4 or Gumbo while it&#8217;s in beta) and I was astonished to see the linear background gradient options removed from CSS styles.  After some research I found an article by Peter deHaan over at flexexamples.com.  His article was somewhat [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with the <a href="http://labs.adobe.com/technologies/flashbuilder4/" target="_blank">beta release of Flex Builder 4</a> (now called Flash Builder 4 or Gumbo while it&#8217;s in beta) and I was astonished to see the linear background gradient options removed from CSS styles.  After some research I found an article by Peter deHaan over at <a href="http://blog.flexexamples.com/2009/03/13/setting-a-linear-gradient-background-on-an-fxapplication-container-in-flex-gumbo/" target="_blank">flexexamples.com</a>.  His article was somewhat dated in that it didn&#8217;t include the new (heavily debated) namespace changes, so I changed his source to include the new namespace rules and, voila, it worked perfectly.</p>
<p>It seems that you must create a new MXML component that extends the fx:Skin component and use FXG to draw the gradient yourself on the skin.  You then set the skinClass property of the fx:Application to your newly created MXML fx:Skin component.</p>
<p><a href="http://adambergman.com/lab/gumbogradient/" target="_blank">See the Application in Action</a><br />
<a href="http://adambergman.com/lab/gumbogradient/srcview/index.html" target="_blank">View the Source</a></p>
<p style="text-align: center;"><img class="size-full wp-image-69 aligncenter" title="fx:Application with Linear Gradient Background" src="http://www.adambergman.com/wp-content/uploads/2009/06/gradient.png" alt="fx:Application with Linear Gradient Background" width="602" height="493" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.adambergman.com/2009/06/01/application-background-gradients-in-flash-builder-4-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

