<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Flex 4 Component States vs. Skin States</title>
	<atom:link href="http://saturnboy.com/2009/09/flex4-component-states-skin-states/feed/" rel="self" type="application/rss+xml" />
	<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/</link>
	<description>Code, Work, and Life</description>
	<lastBuildDate>Thu, 10 May 2012 17:13:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: justin</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-211</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Mon, 08 Nov 2010 23:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-211</guid>
		<description>@Dave: Perfect.  Good suggestion!</description>
		<content:encoded><![CDATA[<p>@Dave: Perfect.  Good suggestion!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-210</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 08 Nov 2010 23:10:33 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-210</guid>
		<description>In your step #3, instead of repeating &lt;code&gt;invalidateSkinState()&lt;/code&gt; on every &lt;code&gt;State&lt;/code&gt;, I used the &lt;code&gt;CURRENT_STATE_CHANGE&lt;/code&gt; event to invalidate the skin state.

&lt;p class=&quot;bottom&quot;&gt;This can be baked into the underlying component, like this:&lt;/p&gt;

&lt;pre lang=&quot;actionscript&quot;&gt;
public function MyComponent() extends SkinnableComponent {

    public function MyComponent() {
        addEventListener(StateChangeEvent.CURRENT_STATE_CHANGE, onCurrentStateChange);
    }

    private function onCurrentStateChange(event:StateChangeEvent):void {
        invalidateSkinState();
    }
}
&lt;/pre&gt;

Now if you just use &lt;code&gt;MyComponent&lt;/code&gt; everywhere, its &lt;code&gt;SkinState&lt;/code&gt; will be invalidated every time its &lt;code&gt;State&lt;/code&gt; changes.  Easy.</description>
		<content:encoded><![CDATA[<p>In your step #3, instead of repeating <code>invalidateSkinState()</code> on every <code>State</code>, I used the <code>CURRENT_STATE_CHANGE</code> event to invalidate the skin state.</p>
<p class="bottom">This can be baked into the underlying component, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyComponent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">extends</span> SkinnableComponent <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyComponent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        addEventListener<span style="color: #66cc66;">&#40;</span>StateChangeEvent.<span style="color: #006600;">CURRENT_STATE_CHANGE</span>, onCurrentStateChange<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onCurrentStateChange<span style="color: #66cc66;">&#40;</span>event:StateChangeEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        invalidateSkinState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Now if you just use <code>MyComponent</code> everywhere, its <code>SkinState</code> will be invalidated every time its <code>State</code> changes.  Easy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zvi</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-208</link>
		<dc:creator>zvi</dc:creator>
		<pubDate>Wed, 27 Oct 2010 07:33:58 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-208</guid>
		<description>you really helped me SO much!</description>
		<content:encoded><![CDATA[<p>you really helped me SO much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-197</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Fri, 08 Oct 2010 12:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-197</guid>
		<description>Hi, great article! Opened my eyes for some possibilities. However when I use the approach described by you, the flex compiler complains that required states &#039;normal&#039; and &#039;disabled&#039; are missing from the host component. Any ideas how to fix this issue?</description>
		<content:encoded><![CDATA[<p>Hi, great article! Opened my eyes for some possibilities. However when I use the approach described by you, the flex compiler complains that required states &#8216;normal&#8217; and &#8216;disabled&#8217; are missing from the host component. Any ideas how to fix this issue?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-195</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Thu, 23 Sep 2010 19:24:06 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-195</guid>
		<description>@Joe: Alas, because we have both &quot;component&quot; states and &quot;skin&quot; states, it can look like we are repeating ourselves, but you are seeing the minimum.

In &lt;code&gt;Smiley&lt;/code&gt; we have 3 &lt;code&gt;SkinState&lt;/code&gt;s and 3 &lt;code&gt;State&lt;/code&gt;s, I just made the names the same.  It would be nice if &lt;code&gt;State&lt;/code&gt; had some attribute to promote the component state to a skin state.  Then I could just say &lt;code&gt;isSkinStateToo=&quot;true&quot;&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>@Joe: Alas, because we have both &#8220;component&#8221; states and &#8220;skin&#8221; states, it can look like we are repeating ourselves, but you are seeing the minimum.</p>
<p>In <code>Smiley</code> we have 3 <code>SkinState</code>s and 3 <code>State</code>s, I just made the names the same.  It would be nice if <code>State</code> had some attribute to promote the component state to a skin state.  Then I could just say <code>isSkinStateToo="true"</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Konczal</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-194</link>
		<dc:creator>Joe Konczal</dc:creator>
		<pubDate>Thu, 23 Sep 2010 15:11:22 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-194</guid>
		<description>Thanks for all the clear, concise, and useful articles.  There is one thing that bothers me, though, in the code for this one.  In the smileys example, all the states are enumerated in four different places.  In the grades examples there are even more lists of states.  Is there a way to reduce the number of places where the states need to be listed?</description>
		<content:encoded><![CDATA[<p>Thanks for all the clear, concise, and useful articles.  There is one thing that bothers me, though, in the code for this one.  In the smileys example, all the states are enumerated in four different places.  In the grades examples there are even more lists of states.  Is there a way to reduce the number of places where the states need to be listed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-182</link>
		<dc:creator>Jake</dc:creator>
		<pubDate>Sun, 15 Aug 2010 16:49:59 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-182</guid>
		<description>Great article.  Clear and comprehensive, thanks man!</description>
		<content:encoded><![CDATA[<p>Great article.  Clear and comprehensive, thanks man!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-152</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Thu, 24 Jun 2010 16:33:01 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-152</guid>
		<description>@John - yes, nowadays, I also tend to write my custom components in AS3 rather than MXML for most cases.  But I&#039;ll still use MXML when my custom component contains a bunch of other components (thereby leveraging the power of MXML to add and layout components).

And yes, compound skin states are cool.  I just wrote a custom button with:

&lt;code&gt;return super.getCurrentSkinState() + (alerted ? &#039;AndAlerted&#039; : &#039;&#039;);&lt;/code&gt;

So my states where: &lt;code&gt;up&lt;/code&gt;, &lt;code&gt;over&lt;/code&gt;, &lt;code&gt;down&lt;/code&gt;, &lt;code&gt;disabled&lt;/code&gt; and &lt;code&gt;upAndAlerted&lt;/code&gt;, &lt;code&gt;overAndAlerted&lt;/code&gt;, &lt;code&gt;downAndAlerted&lt;/code&gt;, &lt;code&gt;disabledAndAlerted&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>@John &#8211; yes, nowadays, I also tend to write my custom components in AS3 rather than MXML for most cases.  But I&#8217;ll still use MXML when my custom component contains a bunch of other components (thereby leveraging the power of MXML to add and layout components).</p>
<p>And yes, compound skin states are cool.  I just wrote a custom button with:</p>
<p><code>return super.getCurrentSkinState() + (alerted ? 'AndAlerted' : '');</code></p>
<p>So my states where: <code>up</code>, <code>over</code>, <code>down</code>, <code>disabled</code> and <code>upAndAlerted</code>, <code>overAndAlerted</code>, <code>downAndAlerted</code>, <code>disabledAndAlerted</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Hicks</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-150</link>
		<dc:creator>John Hicks</dc:creator>
		<pubDate>Thu, 24 Jun 2010 04:59:59 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-150</guid>
		<description>Yes, thank you Justin especially for that last step, where you compound the states. 

I do all components in AS3 and only the skins in MXML.  Extend SkinnableComponent and override at most seven methods:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;set&lt;/code&gt; - set property and call invalidateProperties()&lt;/li&gt;
&lt;li&gt;&lt;code&gt;invalidateProperties()&lt;/code&gt; - say properties have changed&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commitProperties()&lt;/code&gt; - act on combination of properties&lt;/li&gt;
&lt;li&gt;&lt;code&gt;invalidateDisplay()&lt;/code&gt; - if property change should change display&lt;/li&gt;
&lt;li&gt;&lt;code&gt;updateDisplayList()&lt;/code&gt; - only if you must intrude on layout...&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getCurrentSkinState()&lt;/code&gt; - when skin needs to know what to show...&lt;/li&gt;
&lt;li&gt;&lt;code&gt;partAdded()&lt;/code&gt; - watch for parts you need to initialize (addEventListener, etc)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;partRemoved()&lt;/code&gt; - clean up whatever partAdded() did&lt;/li&gt;
&lt;/ul&gt;

John Hicks</description>
		<content:encoded><![CDATA[<p>Yes, thank you Justin especially for that last step, where you compound the states. </p>
<p>I do all components in AS3 and only the skins in MXML.  Extend SkinnableComponent and override at most seven methods:</p>
<ul>
<li><code>set</code> &#8211; set property and call invalidateProperties()</li>
<li><code>invalidateProperties()</code> &#8211; say properties have changed</li>
<li><code>commitProperties()</code> &#8211; act on combination of properties</li>
<li><code>invalidateDisplay()</code> &#8211; if property change should change display</li>
<li><code>updateDisplayList()</code> &#8211; only if you must intrude on layout&#8230;</li>
<li><code>getCurrentSkinState()</code> &#8211; when skin needs to know what to show&#8230;</li>
<li><code>partAdded()</code> &#8211; watch for parts you need to initialize (addEventListener, etc)</li>
<li><code>partRemoved()</code> &#8211; clean up whatever partAdded() did</li>
</ul>
<p>John Hicks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavel Jacko</title>
		<link>http://saturnboy.com/2009/09/flex4-component-states-skin-states/comment-page-1/#comment-54</link>
		<dc:creator>Pavel Jacko</dc:creator>
		<pubDate>Mon, 16 Nov 2009 17:41:01 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=692#comment-54</guid>
		<description>This is great post! I used this technique on article about different solutions for skinning in Flex 4 here: http://blog.paveljacko.com/?p=29</description>
		<content:encoded><![CDATA[<p>This is great post! I used this technique on article about different solutions for skinning in Flex 4 here: <a href="http://blog.paveljacko.com/?p=29" rel="nofollow">http://blog.paveljacko.com/?p=29</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

