<?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>FlexWiz Blog &#187; Skinning</title>
	<atom:link href="http://blog.flexwiz.net/tag/skinning/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexwiz.net</link>
	<description>On Game Development and the Flash platform</description>
	<lastBuildDate>Sat, 17 Dec 2011 22:46:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Flex 4.5 – A ‘Hero’s Welcome</title>
		<link>http://blog.flexwiz.net/flex-4-5-a-hero-welcome/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flex-4-5-a-hero-welcome</link>
		<comments>http://blog.flexwiz.net/flex-4-5-a-hero-welcome/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 23:20:43 +0000</pubDate>
		<dc:creator>theWiz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Hero]]></category>
		<category><![CDATA[Skinning]]></category>
		<category><![CDATA[Spark]]></category>

		<guid isPermaLink="false">http://flexwiz.amosl.com/?p=433</guid>
		<description><![CDATA[It&#8217;s been a while since Flex 4.5 public beta was released. I spent some time with the the new SDK and following blogs, getting the feel of it.  The 4.5 &#8220;Hero&#8221; SDK is expected to release later this year, along with a new version of flash player (10.2) . In previous posts (Spark pains) I expressed my disappointment [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-449" style="margin: 4px;" title="hero" src="http://blog.flexwiz.net/wp-content/uploads/2011/01/hero.png" alt="" width="216" height="176" />It&#8217;s been a while since Flex 4.5 public beta was released. I spent some time with the the new SDK and following blogs, getting the feel of it.  The 4.5 &#8220;Hero&#8221; SDK is expected to release later this year, along with a new version of flash player (10.2) .</p>
<p>In previous posts (<a href="http://blog.flexwiz.net/flex/spark-pains-is-it-worth-it/" target="_blank">Spark pains</a>) I expressed my disappointment with Spark&#8217;s lack of functionality versus the Flex 3 mx components it came to replace. <a href="http://jessewarden.com/2010/09/adobe-please-bring-flash-builder-up-to-par.html" target="_blank">Like others</a>, I shared the notion that Spark is half baked, and Adobe should have included a more complete solution in version 4.0 or 4.1, at least for the included components like button or image. Let&#8217;s see what is in for us in the upcoming Flex 4.5 (&#8220;Hero&#8221;).</p>
<p><span id="more-433"></span></p>
<h3>Spark Button: The return of the Icon</h3>
<p>Good news &#8211; the icon style is back to Spark button!  After spending a lot of time writing custom skins and specialized classes I was glad to see that the spark button now supports icon out of the box, just like the good old mx button. Too bad it came  late for my recent projects, all using spark buttons, cluttered with custom skins only to achieve the trivial task of putting an icon in a button.</p>
<p>By any reasonable standard, we should have had these  in Flex 4.0 release last year.</p>
<p>I can only reiterate the comment in a post in the <a href="http://blog.flexexamples.com/" target="_blank">Flex Examples</a> blog: all that to get what we’ve had for years in Flex 3.  I really am glad these basic features are back, but was it really necessary to wait over a year to have it back (and require Flash 10.2 player)?</p>
<p>Really, Adobe &#8211; is that too much to expect?</p>
<h3>Spark Bitmap Image</h3>
<p>Another source of frustration for me was the spark BitmapImage. Made to replace mx image, it gave similar functionality&#8230; well, almost. No support for runtime loading and display of timeline swfs forced me and my team to fall-back to mx image for no other alternative.</p>
<p>Even worse, the overblown security model made image caching almost impossible to implement. Try constantly loading images from services like flikr and facebook and see what I mean. Policy files, trusted or untrusted domains, nothing seems to work properly. To actually make it possible to access bitmapData, everyone uses a PHP script to bypass the flash player security model &#8211; not very elegant.</p>
<p>A Hero to the rescue, Flex 4.5 brings the new and improved  BitmapImage with all of mx image features and built it image caching &#8211; Hallelujah!  they even threw in smart scaling and letterbox mode.  It&#8217;s too soon to comment on how effective it is since it is still in beta, but kudos to Adobe for doing the right thing.</p>
<p>What more can I say? Better late than never.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexwiz.net/flex-4-5-a-hero-welcome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spark List with Zoom Effect</title>
		<link>http://blog.flexwiz.net/spark-list-with-zoom-effect/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=spark-list-with-zoom-effect</link>
		<comments>http://blog.flexwiz.net/spark-list-with-zoom-effect/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 15:30:58 +0000</pubDate>
		<dc:creator>theWiz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Effects]]></category>
		<category><![CDATA[Skinning]]></category>
		<category><![CDATA[Spark]]></category>

		<guid isPermaLink="false">http://flexwiz.amosl.com/?p=379</guid>
		<description><![CDATA[For a recent project  I needed to create a trivial image list with zoom effect for a spark based application. Image lists are commonly used for image galleries or menus, and Flex offers some UI components to quickly create and configure these generic lists, so I did not expect any difficulties. I was wrong. Even [...]]]></description>
			<content:encoded><![CDATA[<p>For a recent project  I needed to create a trivial image list with zoom effect for a spark based application. Image lists are commonly used for image galleries or menus, and Flex offers some UI components to quickly create and configure these generic lists, so I did not expect any difficulties.<br />
I was wrong. Even though creating image lists became an almost trivial task, there are a few pitfalls and none of the samples posted by Adobe were clear enough to address them. After spending some time with <a href="http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#" target="_blank">tour-de-flex</a> samples I managed to come up with a different working solution.</p>
<p>This is what I needed:<br />
<img class="alignnone size-full wp-image-396" title="imgZoom" src="http://blog.flexwiz.net/wp-content/uploads/2010/10/imgZoom.png" alt="" width="550" height="167" /><br />
<span id="more-379"></span></p>
<h2>Basic Image List</h2>
<p>First of all lets consider the options. A list can be created by either a DataGroup or a spark List. Both components can display a list based on data provider and item renderer, but there are a few differences, summarized here:</p>
<ol>
<li>List is skinnable, DataGroup is not.</li>
<li>DataGroup is much lighter</li>
<li>List provides  additional  functionality, namely selection and drag-drop</li>
</ol>
<p>Since I needed the select functionality I decided to go with the List.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:List</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;lst1&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">dataProvider</span>=<span style="color: #ff0000;">&quot;{sampleData}&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">itemRenderer</span>=<span style="color: #ff0000;">&quot;cc.ImageRenderer&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">rollOverColor</span>=<span style="color: #ff0000;">&quot;#cccccc&quot;</span> <span style="color: #000066;">selectionColor</span>=<span style="color: #ff0000;">&quot;#eeee00&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:HorizontalLayout</span> <span style="color: #000066;">gap</span>=<span style="color: #ff0000;">&quot;4&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:List<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>The Item Renderer</h2>
<p>Start with a basic renderer from a template: &#8216;New-&gt;MXML Item Renderer&#8217;. Add an image control as the main display object, and optionally some background. If you try to run you&#8217;ll get a list with static images.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;normal&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;hovered&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;selected&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Rect</span> <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:fill<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SolidColor</span></span>
<span style="color: #009900;">            <span style="color: #000066;">color.normal</span>=<span style="color: #ff0000;">&quot;0x808080&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">color.hovered</span>=<span style="color: #ff0000;">&quot;{getStyle('rollOverColor')}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">color.selected</span>=<span style="color: #ff0000;">&quot;{getStyle('selectionColor')}&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:fill<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Rect<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Image</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;img&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">verticalAlign</span>=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #000066;">horizontalAlign</span>=<span style="color: #ff0000;">&quot;center&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Note that I took advantage of the styles for selection and rollover colors.<br />
Now we add the effect, using the postLayoutTransformOffsets property of the item renderer.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--       The Zoom effect      --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:postLayoutTransformOffsets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:TransformOffsets</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tOffsets&quot;</span></span>
<span style="color: #009900;">                        <span style="color: #000066;">scaleX</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">scaleY</span>=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #009900;">                        <span style="color: #000066;">scaleX.hovered</span>=<span style="color: #ff0000;">&quot;1.5&quot;</span> <span style="color: #000066;">scaleY.hovered</span>=<span style="color: #ff0000;">&quot;1.5&quot;</span></span>
<span style="color: #009900;">                        <span style="color: #000066;">scaleX.selected</span>=<span style="color: #ff0000;">&quot;1.1&quot;</span> <span style="color: #000066;">scaleY.selected</span>=<span style="color: #ff0000;">&quot;1.1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:postLayoutTransformOffsets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!--       Transitions          --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:transitions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Transition</span> <span style="color: #000066;">toState</span>=<span style="color: #ff0000;">&quot;hovered&quot;</span> <span style="color: #000066;">autoReverse</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;s:Animate</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;{tOffsets}&quot;</span> <span style="color: #000066;">duration</span>=<span style="color: #ff0000;">&quot;200&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SimpleMotionPath</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;scaleX&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SimpleMotionPath</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;scaleY&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Animate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Transition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Transition</span> <span style="color: #000066;">fromState</span>=<span style="color: #ff0000;">&quot;hovered&quot;</span> <span style="color: #000066;">autoReverse</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;s:Animate</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;{tOffsets}&quot;</span> <span style="color: #000066;">duration</span>=<span style="color: #ff0000;">&quot;200&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SimpleMotionPath</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;scaleX&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SimpleMotionPath</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;scaleY&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Animate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Transition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:transitions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>To make the scale work from the center, simply set transformX and transformY to half the size of the renderer. Run the code and see the nice zoom effect on rollover. Works nice overall, but there is one problem &#8211; since the items are scaled during the effect, the area for the list is based on the normal scale, clipping the oversized item on the edges of the list. Simply put, we need some more space between the list and its container &#8211; which brings us to skinning.</p>
<h2>Skinning the list</h2>
<p>The default skin for spark list is basically a DataGroup enclosed within a scroll component. Simply adding margins between the list and the scroller will not do &#8211; the images would still get clipped. We need to wrap the list in a group, so that clipping can be controlled. Replacing the scroller block with the following code will do the trick.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- The Scroller component to add scroll bars to the list. --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Scroller</span> <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;scroller&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;s:Group</span> <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:DataGroup</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;dataGroup&quot;</span></span>
<span style="color: #009900;">                     <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;22&quot;</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;26&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;22&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;26&quot;</span></span>
<span style="color: #009900;">                     <span style="color: #000066;">itemRenderer</span>=<span style="color: #ff0000;">&quot;spark.skins.spark.DefaultItemRenderer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:DataGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Group<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Scroller<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Final Result</h2>
<p> <a href="http://blog.flexwiz.net/sources/listdemo/bin/ListDemo.swf" target="_blank"><img src="http://blog.flexwiz.net/wp-content/uploads/2010/10/demo_button.png" alt="" title="View Demo" width="200" height="60" class="alignnone size-full wp-image-410" /></a>    <a href="http://blog.flexwiz.net/sources/listdemo/" target="_blank"><img src="http://blog.flexwiz.net/wp-content/uploads/2010/10/ViewSource.png" alt="" title="View Source" width="200" height="60" class="alignnone size-full wp-image-412" /></a></p>
<p>The demo app contains the three different lists to compare the effect of the skin and rederer.<br />
Looking at the final result, we got a slightly modified skin for the list and the item renderer. Most of the effort went on skinning &#8211; not bad, considering the list itself and the effect are used almost out of the box.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexwiz.net/spark-list-with-zoom-effect/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tip: Easy Spark Icon Button</title>
		<link>http://blog.flexwiz.net/tip-easy-spark-icon-button/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tip-easy-spark-icon-button</link>
		<comments>http://blog.flexwiz.net/tip-easy-spark-icon-button/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 13:27:28 +0000</pubDate>
		<dc:creator>theWiz</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Skinning]]></category>
		<category><![CDATA[Spark]]></category>

		<guid isPermaLink="false">http://flexwiz.amosl.com/?p=268</guid>
		<description><![CDATA[I needed a simple spark button with only an icon &#8211; basically a bitmap made into a button. The problem is that I have lots of these buttons, each with a different icon &#8211; and all the skin samples use hard-coded assets. UPDATE:  The new Flex 4.5 Hero has this feature built in, as described in [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a simple spark button with only an icon &#8211; basically a bitmap made into a button. The problem is that I have lots of these buttons, each with a different icon &#8211; and all the skin samples use hard-coded assets.</p>
<p>UPDATE:  The new Flex 4.5 Hero has this feature built in, as described in<a href="http://blog.flexwiz.net/flex/flex-4-5-a-hero-welcome/" target="_blank"> this recent post</a>.</p>
<p>Well, the old Button class used to have an icon style (it was called skin or upSkin) so I decided to bring back the icon style so I&#8217;d be able to reuse the same skin and pass a different icon to each instance.<br />
<span id="more-268"></span></p>
<p>Usage:</p>
<p>The IconButton class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> cs
<span style="color: #000000;">&#123;</span>
        <span style="color: #009900; font-style: italic;">// icon style</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;icon&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> IconButton <span style="color: #0033ff; font-weight: bold;">extends</span> Button
	<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now the generic icon button skin (IconBtnSkin):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		[HostComponent(&quot;cc.IconButton&quot;)] 
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;up&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;over&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;down&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;disabled&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- icon --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:BitmapImage</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;{hostComponent.getStyle('icon')}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>To use, just use the skin with the IconButton class, and set the icon style to the asset of choice:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cc:IconButton</span> <span style="color: #000066;">skin</span>=<span style="color: #ff0000;">&quot;IconBtnSkin&quot;</span> <span style="color: #000066;">icon</span>=<span style="color: #ff0000;">&quot;myAsset&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></div></div>

<p>You can also couple the skin with the IconButton class explicitly by setting the skinClass from the constructor:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">	<span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;skinClass&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;skins.IconBtnSkin&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.flexwiz.net/tip-easy-spark-icon-button/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Spark Tabs with Close Button</title>
		<link>http://blog.flexwiz.net/spark-tabs-with-close-button/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=spark-tabs-with-close-button</link>
		<comments>http://blog.flexwiz.net/spark-tabs-with-close-button/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 19:53:05 +0000</pubDate>
		<dc:creator>theWiz</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Skinning]]></category>
		<category><![CDATA[Spark]]></category>
		<category><![CDATA[Tabs]]></category>

		<guid isPermaLink="false">http://flexwiz.amosl.com/?p=220</guid>
		<description><![CDATA[In a recent post here, I shared my rants regarding usability of several spark components. Well, its better to act than to complain, so I decided to try and roll my own tab control. Easy tab navigation For anyone who used SuperTabBar from flexlib, the functionality is more-or-less the same. However, while the SuperTab is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-227 alignright" title="TabShot" src="http://blog.flexwiz.net/wp-content/uploads/2010/04/TabShot.png" alt="" width="208" height="158" /><br />
In a recent post <a href="http://blog.flexwiz.net/flex/spark-pains-is-it-worth-it/">here</a>, I shared my rants regarding usability of several spark components. Well, its better to act than to complain, so I decided to try and roll my own tab control.</p>
<p><span id="more-220"></span></p>
<h2>Easy tab navigation</h2>
<p>For anyone who used SuperTabBar from flexlib, the functionality is more-or-less the same. However, while the SuperTab is based on mx components, mine is derived from spark TabBar. To make it light and compact, I did not implement dragging of tabs, and focused on easy to use &#8216;tab close&#8217; functionality.</p>
<p><a href="http://blog.flexwiz.net/wp-content/uploads/2010/04/TabDemo.swf"  target="_blank"><img class="alignnone size-full wp-image-228" style="margin-left: 20px; margin-right: 20px;" title="TabDemoTn" src="http://blog.flexwiz.net/wp-content/uploads/2010/04/TabDemoTn.png" alt="" width="168" height="88" /></a> <a href="http://blog.flexwiz.net/sources/tabsrc/" target="_blank"><img class="alignnone size-full wp-image-111" title="getsource" src="http://blog.flexwiz.net/wp-content/uploads/2010/02/getsource.png" alt="" width="210" height="90" /></a></p>
<p>Features:</p>
<ul>
<li>Adjustable gap through &#8216;gap&#8217; style</li>
<li>Easy access to Tab skin from the TabBar via the &#8216;tabSkin&#8217; style </li>
<li>Global and individual close policy</li>
<li>Default skins are supplied, used if no other skin is set</li>
</ul>
<p>Usage:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plus:TabBarPlus</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;bar&quot;</span> <span style="color: #000066;">gap</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">cornerRadius</span>=<span style="color: #ff0000;">&quot;4&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">styleName</span>=<span style="color: #ff0000;">&quot;barStyle&quot;</span>  <span style="color: #000066;">closePolicy</span>=<span style="color: #ff0000;">&quot;always&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">dataProvider</span>=<span style="color: #ff0000;">&quot;{mainStack}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Let me know about any problems or bugs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flexwiz.net/spark-tabs-with-close-button/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

