<?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>Bill White's Blog</title>
	<atom:link href="http://www.billdwhite.com/wordpress/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.billdwhite.com/wordpress</link>
	<description>Focusing on Adobe Flex Development</description>
	<lastBuildDate>Mon, 28 Jun 2010 16:28:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tile Options Demo using Flex 4</title>
		<link>http://www.billdwhite.com/wordpress/?p=373</link>
		<comments>http://www.billdwhite.com/wordpress/?p=373#comments</comments>
		<pubDate>Tue, 11 May 2010 20:25:25 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=373</guid>
		<description><![CDATA[In a previous post, I showed a demo of a custom list component created with Degrafa.  I received a request for the same application done with Flex 4 and FXG, so I spent a little time converting it over and here is the result. (** requires Flash Player 10)  I&#8217;m sure I could have used [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.billdwhite.com/wordpress/?p=44">previous post</a>, I showed a demo of a custom list component created with Degrafa.  I received a request for the same application done with Flex 4 and FXG, so I spent a little time converting it over and here is the result.  (** requires Flash Player 10)<br />
<span id="more-373"></span><br />
 I&#8217;m sure I could have used the new features of Flex 4 even more efficiently than I did, so please feel free to let me know how to improve upon this implementation if you have any suggestions.</p>
<p id="tileOptionsDemoFlex4Paragraph" align="center">
<object width="560" height="575">
<param name="movie" value="wp-content/demos/TileOptionsDemoFlex4/TileOptionsDemoFlex4.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="560" height="575" src="wp-content/demos/TileOptionsDemoFlex4/TileOptionsDemoFlex4.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=373</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Core Flex 4 &#8211; Filters in spark.filters vs flash.filters</title>
		<link>http://www.billdwhite.com/wordpress/?p=307</link>
		<comments>http://www.billdwhite.com/wordpress/?p=307#comments</comments>
		<pubDate>Wed, 14 Apr 2010 03:48:38 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=307</guid>
		<description><![CDATA[After looking briefly at the API docs, I noticed that there are duplicates of several of the filter classes with the same name.  For example, there is a DropShadowFilter in the spark.filters package and there is another one by the same name in the flash.filters package. After looking at the source for the DropShadowFilter in [...]]]></description>
			<content:encoded><![CDATA[<p>After looking briefly at the API docs, I noticed that there are duplicates of several of the filter classes with the same name.  For example, there is a <strong>DropShadowFilter</strong> in the <strong>spark.filters</strong> package and there is another one by the same name in the <strong>flash.filters</strong> package.<br /> <span id="more-307"></span><br /> After looking at the source for the <strong>DropShadowFilter</strong> in the <strong>spark.filters</strong> package, it appears that the filters in the <strong>spark.filters</strong> package are basically just wrappers that return their flash.filters packaged equivalent from the clone() method.  I&#8217;m guessing that they just wanted to create filters that fell inside the spark package structure that could be improved or extended at a later time.  You can easily replace this: <code>&lt;s:DropShadowFilter /&gt;</code> with this: <code>&lt;mx:DropShadowFilter /&gt;</code> and get the same result.</p>
<p>Any one have a better explanation?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=307</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Core Flex 4 &#8211; Elements vs Children</title>
		<link>http://www.billdwhite.com/wordpress/?p=296</link>
		<comments>http://www.billdwhite.com/wordpress/?p=296#comments</comments>
		<pubDate>Thu, 08 Apr 2010 18:15:28 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=296</guid>
		<description><![CDATA[When I started using Flex 4 I tried to get up to speed by using the new version in a manner similar to its predecessor until I came across roadblocks or when I determined I was able to take advantage of the new features I had heard about such as skinning, states, etc. I quickly [...]]]></description>
			<content:encoded><![CDATA[<p>When I started using Flex 4 I tried to get up to speed by using the new version in a manner similar to its predecessor until I came across roadblocks or when I determined I was able to take advantage of the new features I had heard about such as skinning, states, etc. I quickly found that there were some obvious Flex questions that I was not able to answer without diving into the API docs and by playing with some examples so I could truly understand what is going on.   I knew from past experience that Halo was hiding a lot of the dirty details about what was going on in the display list, but once you start using Spark, you will come to see just how much Halo was really doing under the covers and why Spark is a much more &#8216;honest&#8217; way of working with the display list.<br /> <span id="more-296"></span></p>
<p>One of the first things I hit was the term &#8216;elements&#8217;.  What is an element?  Is it the same thing as a child?  Initially I concluded that elements where just another way of saying children (wrong).  I figured that all elements where child components and vice versa.  Then I noticed that some of the methods that I was expecting to find inside the new containers (as well as some of the existing ones) were missing. Where is getElements()?  How do I find out how many elements I have?  Can I just use <strong>getChildren()</strong> and treat the result like an <strong>IVisualElement</strong> (which itself was a mystery to me at the time).</p>
<p>So I started to <em>really</em> read the API docs, Flex source and blog postings about these topics.  I also tried to decipher the slides shows that some bloggers posted about the great new features of Flex 4, but it turns out the slides do not make much sense if you do not have the audio of the presentation to go along with them.</p>
<p>Finally, I started to put together some very basic demos that would help me explore the new world of elements and help me figure out what I was really doing when it came to using the new Spark containers.</p>
<p>I&#8217;ll start by stating the questions I had at the time. Question number one was &#8220;How do I get the all the elements of a spark container?&#8221;  I was expecting a getElements() method similar to the familiar <strong>getChildren()</strong> method from Flex 3.  Instead, what you have are two properties: <strong>numElements</strong> and <strong>numChildren</strong>.  To obtain all of the elements of a container, you can use a for-loop with the numElements count and call the getElementAt() method for each one.  Pretty obvious after you realize there is no getElements convenience method. Question number two was: &#8220;what is the difference between an element and a child?&#8221;.  Let&#8217;s look at the difference between elements and children&#8230;.</p>
<p>An element is basically anything that implements the <strong>IVisualElement</strong> interface.  A child is anything that extends from <strong>DisplayObject</strong>.  When trying to determine if a component is an element or a child or both, remember that a <strong>UIComponent</strong> is a descendant of DisplayObject, so all UIComponents are DisplayObjects and therefore can be children. Also know that UIComponent implements IVisualElement so all UIComponents are considered &#8216;elements&#8217;.  However, this does not mean that all DisplayObjects are elements.  A DisplayObject that is parented by a container (ie, contained within that container) is a child of that container.  But it is only an element of that container if it also implements IVisualElement.  So when is a DisplayObject a child of a container and when is a DisplayObject an element of that container?  Some examples showing different types of containers will answer this question.</p>
<p>In the first example, we look at the result when the container in question is an older Halo container (in this case, a Halo Panel).  Because Panel is a descendant of <strong>DisplayObjectContainer</strong>, it has the <strong>addChild()</strong> method.  In addition, because it descends from <strong>Container</strong> (which implements <strong>IVisualElementContainer</strong>), it also has the <strong>addElement()</strong> method.  We will see that the Container&#8217;s implementation of the IVisualElementContainer interface is just a facade to the display list API but it is implemented here so that it will have the same methods that we find in the newer Spark containers that also implement IVisualElementContainer.</p>
<p>So we can add both children and elements to this container.  However, we cannot add just any type of element to it. There is a difference between VisualElements and GraphicElements.  VisualElements implement the <strong>IVisualElement</strong> interface, but GraphicElements implement an extension of IVisualElement called IGraphicElement which has some extra features that the container needs to know about. Therefore, some elements (such as the GraphicElement) cannot be added directly to the Halo Panel.  The compiler will complain that it needs to be wrapped in a Group container first. More on why in a second&#8230;.</p>
<p>The Panel in the following example contains several UIComponents including another Halo Panel, a Spark Panel, some Halo Buttons, some Spark Buttons and a SkinnableContainer with child components of its own. (Note that the components inside the SkinnableContainer will NOT be children of the Panel.  They are children of the SkinnableContainer.)   All of these components are DisplayObjects so they are all &#8216;children&#8217;.  Clicking the &#8216;Show Children&#8221; button reveals as much.  In addition, all of these components are UIComponents (which implements IVisualElement) so they are all &#8216;elements&#8217; as well.</p>
<p align="center">
<object width="550" height="600">
<param name="movie" value="wp-content/demos/CoreFlex4ElementsDemo/CoreFlex4ElementsDemo01.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="550" height="600" src="wp-content/demos/CoreFlex4ElementsDemo/CoreFlex4ElementsDemo01.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>Now take a look at the next example.  This time the container in question is a Spark Group.  Like the Halo Panel in the previous example, Group is a descendant of DisplayObjectContainer so it has the addChild() method and because it implements IVisualElementContainer, we can add IVisualElements (&#8216;elements&#8217;) to it as well using addElement().  The Group container can also handle GraphicElements such as a Rect (a Rectangle GraphicElement) which the Halo Panel could not.  This is because, unlike the Halo Panel, the Group object knows how to display GraphicElements in an optimized manner.  What does that mean? Read on&#8230;</p>
<p>GraphicElements require a little more involvement from their parent containers than do regular VisualElements.  The key here is the <strong>IGraphicElement</strong> interface that GraphicElements implement.  As I mentioned before, it is an extension of the IVisualElement interface (which is why GraphicElements can be added to the Group through the Group&#8217;s addElement() method).  But GraphicElements are not DisplayObjects so they cannot be seen unless they get &#8216;drawn&#8217; onto another DisplayObject by their parent.  So if you add a Rectangle to a Group, the Group will also need to have a DisplayObject to draw the Rectangle on so it will show up in that Group.  Just to optimize things a bit, the Group can actually reuse the same DisplayObject to draw multiple GraphicElements when possible.  The container can use any DisplayObject that implements ISharedDisplayObject to draw the GraphicElement. In the first example, the Halo Panel could not do this so it could not draw GraphicElements in this optimized manner.  Thus, the compiler gave an error saying you have to wrap it in a container that can deal with this.  The Group container can do this so GraphicElements can be added to a Group.</p>
<p>One other thing to note: while some GraphicElements will allow the Group parenting them to create a DisplayObject for that GraphicElement to be drawn in, others will create their own DisplayObjects to be drawn in, and this interface (IGraphicElement) allows the parent Group to manage that DisplayObject even though the parent Group did not create it.(ie to add the DisplayObject as a child so the IGraphicElement can be drawn into it).</p>
<p>So what does this mean?  It means that in our next example, the number of children is not the same as the number of elements.  This example uses the same set of components from the first example, but it adds 4 rectangles which are GraphicElements. The children are all IVisualElements. However, they are not all children.  The rectangles are GraphicElements which do not descend from DisplayObject.  BUT, the Group knows that it needs to add DisplayObjects so that the GraphicElements can be drawn inside the container.  The rectangles are different sizes and rotations so the Group decided to add two new DisplayObjects to draw the four rectangles on. Pretty cool, huh?</p>
<p align="center">
<object width="550" height="800">
<param name="movie" value="wp-content/demos/CoreFlex4ElementsDemo/CoreFlex4ElementsDemo02.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="550" height="800" src="wp-content/demos/CoreFlex4ElementsDemo/CoreFlex4ElementsDemo02.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>Now look at example 3.  Instead of a Group, we are using a SkinnableContainer. The SkinnableContainer has the same set of components as the previous example.  But, the SkinnableContainer uses a Skin for its visual representation and that Skin is the first and only child of the SkinnableContainer.  The SkinnableContainer&#8217;s default Skin class is comprised of a Rectangle (for the border) and a Group called the ContentGroup which all skins for containers need so Flex know where to add children to the container.</p>
<p>So this example illustrates the fact that, while the SkinnableContainer has 10 elements, it only has one child: the Skin of the SkinnableContainer.  In turn, that skin has only one child:  the ContentGroup Group component.  You may be asking &#8220;why are there not 2 children of the Skin: one being the ContentGroup and the other being the DisplayObject for the Rectangle (serving as the border) to be drawn in?  The answer is because the Skin class descends from the Group class and Groups will add DisplayObjects when necessary to draw any GraphicElements they contain.  In this case, no new DisplayObjects were required.  The Skin class just drew the Rect GraphicElement directly onto itself.  It can do this because the Skin&#8217;s ancestor, the Group class, also implements <strong>ISharedDisplayObject</strong> which means that it can serve as a shared DisplayObject used to draw GraphicElements when necessary.  So the Skin manages the DisplayObjects used to render the GraphicElement, and the in this case, the DisplayObject it is using to draw on is itself!  If you added other Rectangles to a custom skin and assigned that to the SkinnableContainer, the Skin might decide it needed more DisplayObjects to draw those other Rectangles and you would therefore see more children in the Skin&#8217;s child list.</p>
<p>One other thing to note is that the number of elements stays the same when you look at the element list for the SkinnableContainer, its Skin, and the Skin&#8217;s ContentGroup.  If you look at the source for SkinnableContainer, you will see that it determines the numElements value by getting the corresponding numElements value from the currentContentGroup so basically it is just re-routing you to its content group when you query for elements.  Likewise, the Skin of the SkinnableContainer does something similar.  It extends from Group, which gets the numElements property from its internal mxmlContent property which is an array of visual content children for this Group.  Both of these are analogous to the RawChildren property of the Panel container which you used to get ALL the children of the Panel rather than just the children that you added to the Panel which came from the getChildren() method.</p>
<p align="center">
<object width="550" height="750">
<param name="movie" value="wp-content/demos/CoreFlex4ElementsDemo/CoreFlex4ElementsDemo03.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="550" height="750" src="wp-content/demos/CoreFlex4ElementsDemo/CoreFlex4ElementsDemo03.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>After reading all of this, it may not seem any clearer than when you started.  You basically have to familiarize yourself with the inheritance hierarchy and relationship between 7 different classes/interfaces:</p>
<p>1. DisplayObject<br /> 2. UIComponent<br /> 3. Container,<br /> 4. IVisualElement,<br /> 5. IGraphicElement,<br /> 6. IVisualElementContainer<br /> 7. ISharedDisplayObject</p>
<p>Once you know who these fit together, you&#8217;ll soon understand the difference between elements and children.  I&#8217;m sure I&#8217;ve messed up some of the facts and gotten a few things wrong so feel free to put corrections in the comments section if you think I&#8217;m way off base on any of this.  :)</p>
<p>UPDATE:  Check out these links for more information on this and related topics:</p>
<ul>
<li><a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+DOM+Tree+API">Article on the Gumbo DOM Tree API</a> (this is full of great detail on this topic)</li>
<li><a href="http://flexponential.com/2009/12/08/differences-between-ivisualelement-parent-and-ivisualelement-owner/">Nice example</a> on the the difference between the owner and parent of a component.  Very nice.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=296</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Spark Physics with Flex 4 Components and Box2D</title>
		<link>http://www.billdwhite.com/wordpress/?p=256</link>
		<comments>http://www.billdwhite.com/wordpress/?p=256#comments</comments>
		<pubDate>Mon, 22 Mar 2010 18:05:39 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=256</guid>
		<description><![CDATA[A while back I created a few demos showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI. I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I created a <a href="http://www.billdwhite.com/wordpress/?p=26">few</a> <a href="http://www.billdwhite.com/wordpress/?p=25">demos</a> showing how to combine ActionScript physics engines (as well as 3d engines) with Halo components to create a physics-enabled UI.   I wanted to see what could be done using the new Flex 4 Spark components and I was very surprised to find that almost nothing had been posted about using physics engines with Flex 4.<span id="more-256"></span></p>
<p>So I decided to put something together myself.   Nothing ground-breaking here, but this demo uses the Box2D 2.0 physics engine and combines it with Spark buttons using some ideas I&#8217;ve taken from <a href="http://isfland.com">Eugene Karataev</a> (<a href="http://translate.google.com/translate?hl=en&#038;sl=ru&#038;tl=en&#038;u=http%3A%2F%2Fisfland.com%2F">translated</a>) and his demo using Flex 3 called <a href="http://isfland.com/lab/boxui/boxui.html">FallenUI</a>.  </p>
<p><strong>This demo shows some Spark buttons that become physics-enabled once you click the &#8216;Start Simulation&#8217; button.  You can also drag them around and toss them into each other</strong>.  I&#8217;m sure there is a better way to integrate Flex 4 and Box2D, but this is just a quick and dirty attempt to see if I could get it working with no Halo components involved.  Of course, the source is also available from the context menu.  Let me know what you think. :)</p>
<p align="center">
<object width="550" height="600">
<param name="movie" value="wp-content/demos/SparkPhysicsDemo/SparkPhysicsDemo01.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="550" height="600" src="wp-content/demos/SparkPhysicsDemo/SparkPhysicsDemo01.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=256</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Flex 4 Released</title>
		<link>http://www.billdwhite.com/wordpress/?p=253</link>
		<comments>http://www.billdwhite.com/wordpress/?p=253#comments</comments>
		<pubDate>Mon, 22 Mar 2010 05:39:15 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=253</guid>
		<description><![CDATA[I just checked the Adobe.com website and they&#8217;ve posted the links for the officially released versions of Flex 4 and Flash Builder 4. For those of you who have not yet taken a look at the great new features in Flex 4, I would encourage you to check it out. It is simply awesome.]]></description>
			<content:encoded><![CDATA[<p>I just checked the Adobe.com website and they&#8217;ve <a href="http://www.adobe.com/flashplatform/">posted the links</a> for the officially released versions of Flex 4 and Flash Builder 4.  For those of you who have not yet taken a look at the great new features in Flex 4, I would encourage you to check it out.  It is simply awesome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=253</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The getStackTrace Super Bug</title>
		<link>http://www.billdwhite.com/wordpress/?p=231</link>
		<comments>http://www.billdwhite.com/wordpress/?p=231#comments</comments>
		<pubDate>Tue, 04 Aug 2009 10:44:33 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=231</guid>
		<description><![CDATA[If you happen to be hitting an issue where an application runs fine in the debug version of the Flash player but hangs up in the normal version, read on. This could be your problem. I&#8217;ve made good use of a tip I picked up from McCune on generating a stacktrace in my logging statements [...]]]></description>
			<content:encoded><![CDATA[<p>If you happen to be hitting an issue where an application runs fine in the debug version of the Flash player but hangs up in the normal version, read on.  This could be your problem.  </p>
<p>I&#8217;ve made good use of a <a href="http://dougmccune.com/blog/2008/02/21/sneaky-flex-trick-to-get-the-name-of-any-calling-functions/">tip I picked up from McCune</a> on generating a stacktrace in my logging statements so that I can not only see the method that was called but also from where it was being called.<br />
<span id="more-231"></span><br />
In this particular case, I was trying to determine why my component was getting its maxWidth value changed at some point in the lifecycle.  I overrode the maxWidth accessor using this snippet:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> maxWidth<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;set maxWidth = &quot;</span> + value<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> stackTrace:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> callStackString:<span style="color: #0066CC;">String</span> = stackTrace.<span style="color: #0066CC;">substring</span><span style="color: #66cc66;">&#40;</span>stackTrace.<span style="color: #0066CC;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;---- call stack: &quot;</span> + callStackString + <span style="color: #ff0000;">&quot;... <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">maxWidth</span> = value;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The result is a nice log statement showing me what led up to the call:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">set</span> maxWidth = <span style="color: #cc66cc;">757</span>
---- <span style="color: #0066CC;">call</span> stack:
at BaseContainer<span style="color: #66cc66;">/</span><span style="color: #0066CC;">set</span> maxWidth<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">/</span>Users<span style="color: #66cc66;">/</span>white<span style="color: #66cc66;">/</span>dev<span style="color: #66cc66;">/</span>workspace<span style="color: #66cc66;">/</span>FlexContainerTesting<span style="color: #66cc66;">/</span>src<span style="color: #66cc66;">/</span>BaseContainer.<span style="color: #006600;">as</span>:<span style="color: #cc66cc;">45</span><span style="color: #66cc66;">&#93;</span>
at layouts::HorizontalFlowLayout<span style="color: #66cc66;">/</span>updateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">/</span>Users<span style="color: #66cc66;">/</span>white<span style="color: #66cc66;">/</span>dev<span style="color: #66cc66;">/</span>workspace<span style="color: #66cc66;">/</span>FlexContainerTesting<span style="color: #66cc66;">/</span>src<span style="color: #66cc66;">/</span>layouts<span style="color: #66cc66;">/</span>HorizontalFlowLayout.<span style="color: #006600;">as</span>:<span style="color: #cc66cc;">96</span><span style="color: #66cc66;">&#93;</span>
at BaseContainer<span style="color: #66cc66;">/</span>updateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">/</span>Users<span style="color: #66cc66;">/</span>white<span style="color: #66cc66;">/</span>dev<span style="color: #66cc66;">/</span>workspace<span style="color: #66cc66;">/</span>FlexContainerTesting<span style="color: #66cc66;">/</span>src<span style="color: #66cc66;">/</span>BaseContainer.<span style="color: #006600;">as</span>:<span style="color: #cc66cc;">85</span><span style="color: #66cc66;">&#93;</span>
at mx.<span style="color: #006600;">core</span>::UIComponent<span style="color: #66cc66;">/</span>validateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span>C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UICompone...</pre></td></tr></table></div>

<p>Now this works great until you run into the issue that I did the other day.   According to the Doug&#8217;s posted (at the bottom) and according to the docs, there is a gotcha that I wish I had paid attention to before hitting this problem. Doug&#8217;s post mentions that this only works in the debug player, but to get more specific, the docs point out that it returns a null value:</p>
<p><code>getStackTrace(): Returns the call stack for an error as a string at the time of the error's construction (for the debugger version of Flash Player and the AIR Debug Launcher (ADL) only; returns null if not using the debugger version of Flash Player or the ADL.</code></p>
<p>So this means that the <code>stackTrace</code> variable will be valid when I&#8217;m using the debug version of the Flash player.  But in the normal player, the third line will throw a nullpointer exception.   However, in my application, these null pointers were getting &#8216;eaten&#8217; by the application and never being shown.   </p>
<p>The result?  <strong>The perfect bug</strong>.  One that hides when you look for it.  Because the <code>getStackTrace()</code> method of the Error object returns a valid object in the debug version of the Flash player and a null in the regular version, it was a real pain to figure out why my app worked great on my dev box (with the debug player) and would never finish loading in the regular version of the flash player.   The answer, of course, would be to have runtime errors correctly bubble up to an error dialog in the application so non-debug flash players could indicate that something is wrong.  Alternatively, something like this would also work:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> maxWidth<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;set maxWidth = &quot;</span> + value<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> stackTrace:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>stackTrace <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">var</span> methodNameString:<span style="color: #0066CC;">String</span> = stackTrace.<span style="color: #0066CC;">substring</span><span style="color: #66cc66;">&#40;</span>stackTrace.<span style="color: #0066CC;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;----&amp;gt; call stack method: &quot;</span> + methodNameString + <span style="color: #ff0000;">&quot;... <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">super</span>.<span style="color: #006600;">maxWidth</span> = value;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Just wanted to post this in case anyone else ever got bitten by the same issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=231</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Grading System Demo</title>
		<link>http://www.billdwhite.com/wordpress/?p=98</link>
		<comments>http://www.billdwhite.com/wordpress/?p=98#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:11:48 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=98</guid>
		<description><![CDATA[When I started getting into Flex several years ago, the first real application I created was an online grading system for a small K-12 school that I was consulting with as a side gig.  That was around 2005, and after several years of use, the school has outgrown this initial design.  Since they are no [...]]]></description>
			<content:encoded><![CDATA[<p>When I started getting into Flex several years ago, the first real application I created was an online grading system for a small K-12 school that I was consulting with as a side gig.  That was around 2005, and after several years of use, the school has outgrown this initial design.  Since they are no longer using it, I decided it would be ok to publish a demo.<br />
<span id="more-98"></span><br />
It was fairly rough around the edges, but since it was my first attempt I think it turned out pretty good.  It has several features including:</p>
<ul>
<li>Flex Data Services / Live Cycle Data Services integration, providing real time updates to users.</li>
<li>Instance messaging functionality so users could get notifications in real-time.  This also allowed me to monitor which users were logged in and using the system.</li>
<li>A library of comments which could be saved and then reused by the teachers to speed up the time it took to create reports.</li>
<li>A report-creation wizard to generate blank reports in bulk so the teachers would not have click &#8216;new&#8217; for each student in the class.</li>
<li>PDF report generation (using the <a href="http://www.lowagie.com/iText/">iText </a>framework) combined with an iFrame overlay to make the resulting PDF files look like they are actually in the Flex application.</li>
</ul>
<p>There are two parts to the application.  The <a href="http://www.billdwhite.com/flex/teacher.html">Teacher Portal</a> is where teachers create courses, enroll students and add grade and progress reports.  (I used the Flex Store demo as my inspiration for the animations.).  The <a href="http://www.billdwhite.com/flex/administrator.html">Administrator Portal</a> is where administrators could review the submitted reports and print out PDF files.</p>
<p>For this demo, I&#8217;ve taken out all the private info and used a bunch of stock photos of kids with made-up information. (These are NOT real students and the information is completely fabricated for demonstration purposes)</p>
<p>So take a look and let me know what you think.  They are large so it takes a few seconds to download.   Yes there are bugs and issues, but this was my first attempt from about 3-4 years ago so give me a break :)</p>
<p><a href="http://www.billdwhite.com/flex/teacher.html">Teacher Portal (select any teacher; no password required)</a></p>
<p><a href="http://www.billdwhite.com/flex/administrator.html">Administrator Portal (select any user; no password required)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=98</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PeekPanel &#8211; My New Flex Component</title>
		<link>http://www.billdwhite.com/wordpress/?p=29</link>
		<comments>http://www.billdwhite.com/wordpress/?p=29#comments</comments>
		<pubDate>Wed, 10 Jun 2009 05:30:02 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Rich Internet Applications]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=29</guid>
		<description><![CDATA[This is my latest experiment which I&#8217;ve named the &#8220;PeekPanel&#8221;. I saw this type of animation done on my phone and figured it would be a cool way to hide options or preferences in an application.  It borrows the look and feel from the FlexBook/PageFlip components already out there, but instead of simulating a book, this [...]]]></description>
			<content:encoded><![CDATA[<p>This is my latest experiment which I&#8217;ve named the &#8220;PeekPanel&#8221;. I saw this type of animation done on my phone and figured it would be a cool way to hide options or preferences in an application.  It borrows the look and feel from the <a title="FlexBook" href="http://www.quietlyscheming.com/blog/components/flexbook/">FlexBook</a>/<a title="PageFlip" href="http://www.bytearray.org/?p=77">PageFlip</a> components already out there, but instead of simulating a book, this is more of a way to use the &#8220;flip&#8221; to hide other components.<br />
<span id="more-29"></span><br />
<strong>Try it out by clicking the &#8216;Show Options&#8217; button below</strong> and then change the corners and adjust the angles of the fold using the sliders.  I&#8217;ve also added the ability to see the computed geometry, gradients and lighting with the checkbox options. Click the &#8216;Ok&#8217; button or anywhere on the component other than the revealed (hidden) panel to close the fold.</p>
<p id="peekPanelDemoParagraph" align="center">
<object width="600" height="550">
<param name="movie" value="wp-content/demos/PeekPanelDemo/PeekPanelDemo.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="600" height="550" src="wp-content/demos/PeekPanelDemo/PeekPanelDemo.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>So how did I make it work? Well, step one was to sift through the code from the <a title="PageFlip" href="http://www.bytearray.org/?p=77">PageFlip</a> demo by <a title="Didier Brun" href="http://www.foxaweb.com/">Didier Brun</a> and the <a title="FlexBook" href="http://www.quietlyscheming.com/blog/components/flexbook/">FlexBook</a> code from <a title="Ely Greenfield" href="http://www.quietlyscheming.com/blog/">Ely Greenfield</a>.  I used the PageFlip class from Didier to compute the flip graphic, and then I played around with the gradients and vectors based on what I learned from Ely&#8217;s code.  I found that I liked the flip effect from PageFlip, but not the gradients so I handled them separately.  Rendering the flip is easy.  Computing the gradients is not.  You have to make them follow the movement of the fold and I still do not have it down perfect.  I had to brush up on my geometry and trigonometry and I still had a hard time computing all the angles, so you will see a lot of brute force mathematics where I really should have used more established equations (if I knew what they were).</p>
<p>To finish it off, I incorporated <a title="TweenMax" href="http://blog.greensock.com/tweenmaxas3/">TweenMax</a> (very nice!) to get things to move smoothly and used <a title="Reflection" href="http://http://lab.benstucki.net/archives/reflectionexplorer">Ben Stucki&#8217;s reflection logic</a> along with one of <a title="Scale Nine" href="http://www.scalenine.com/">Juan&#8217;s skins</a> to make it look nice. So after ripping off the really good Flex programmers out there, the result is what you see above.  As usual, the source is provided. :)</p>
<p>You can basically use it by taking the code from the demo mxml, and plugging in your own components within the PeekPanel tag.  Just provide it with the TopPage and HiddenPage components and see what happens.  I have not tested this all that thoroughly so it might not work perfectly. I still need to touch up the gradients which do not always look smooth when the flip is moved at certain angles.  I also need to find a good way to handle components with rounded corners.  If anyone wants to suggest solutions, I&#8217;d love to hear them.</p>
<p>[Note: if you use dynamic rather than static values for the width and height settings, you have to set dynamic binding values for the foldOriginX/foldOriginY to make the animation work properly]</p>
<p><strong>Update</strong><strong>:</strong> I forgot to mention that I used <a title="Flex Logger" href="http://renaun.com/blog/flex-components/rialogger/">Renaun Erickson&#8217;s Flex Logger</a> on this as well.  I&#8217;ve heard from some of you that you need the .swc for this to compile the code so <a title="FlexLogger.swc" href="wp-content/demos/PeekPanelDemo/FlexLogger.swc">here</a> is the one I used or you can go to <a href="http://renaun.com/blog/flex-components/rialogger/">Renaun&#8217;s site</a> to get the code and compile it yourself.  You may have to right-click on the link and use &#8216;save as&#8217; with a name of FlexLogger.swc to get the file to save to your local computer correctly.  Of just remove all the reference to that swc and the logger in the code and go without the logging.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=29</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Day 2 &#8211; 360&#124;Flex Random Thoughts and Observations</title>
		<link>http://www.billdwhite.com/wordpress/?p=188</link>
		<comments>http://www.billdwhite.com/wordpress/?p=188#comments</comments>
		<pubDate>Tue, 19 May 2009 21:54:26 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=188</guid>
		<description><![CDATA[Here are some additional thoughts about 360&#124;Flex so far. In case you missed it, here is day 1. Day 2: Most of the developers here seem to favor macs over pc&#8217;s. My guess is that Apple has at least 60% of the flex-nerd market.  Nice. The axiis framework is really something special.  Once they get [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some additional thoughts about 360|Flex so far.</p>
<p>In case you missed it, <a href="http://www.billdwhite.com/wordpress/?p=179">here is day 1</a>.</p>
<p>Day 2:</p>
<ul>
<li>Most of the developers here seem to favor macs over pc&#8217;s. My guess is that Apple has at least 60% of the flex-nerd market.  Nice.</li>
<li>The <a href="http://axiis.org/examples.html">axiis framework</a> is really something special.  Once they get the transitions in place, it will really be a must-have library for anyone doing data visualization.  The way they are handling layouts and data binding is pretty slick.</li>
<li>Flex 4 is looking better and better but I&#8217;m not going to really get into it until they solidify the api a little more.  <a href="http://www.asfusion.com/">Jeremy Saenz&#8217;s</a> presentation today pointed out that the way skins are implemented in the current pre-release of Gumbo is still somewhat fluid and you can easily find yourself having to go back and re-work your examples.  This is to be expected in code that is still in the early stages of development but it is also what is keeping me from really getting my feet wet.  Once the beta is released, I&#8217;m all over it.</li>
<li>The <a href="http://www.universalmind.com/">Universal Mind</a> guys have really put a lot of thought into their UX efforts.  I was surprised to find out that Adobe&#8217;s UX team is not the only game in town.</li>
<li>I was not aware that <a href="http://merhl.com">Joe Johnson</a> and <a href="http://merhl.com">merhl.com</a> are one in the same.  I&#8217;ve been reading his blog posts for years and yet I never knew who he was.  Actually, I still don&#8217;t know him, but I do know what he looks like now.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=188</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>360&#124;Flex Random Thoughts and Observations</title>
		<link>http://www.billdwhite.com/wordpress/?p=179</link>
		<comments>http://www.billdwhite.com/wordpress/?p=179#comments</comments>
		<pubDate>Mon, 18 May 2009 22:31:08 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.billdwhite.com/wordpress/?p=179</guid>
		<description><![CDATA[My co-worker, Joshua, and I have just completed our first full day of sessions at 360 Flex here in Indianapolis. So far it has been well worth it. Just some random thoughts and observations: The folks here are really cool and very friendly. They seem to be genuinely excited to be here. I&#8217;ve gotten to [...]]]></description>
			<content:encoded><![CDATA[<p>My co-worker, Joshua, and I have just completed our first full day of sessions at 360 Flex here in Indianapolis.  So far it has been well worth it.  Just some random thoughts and observations:</p>
<ul>
<li>The folks here are really cool and very friendly.  They seem to be genuinely excited to be here.</li>
<li>I&#8217;ve gotten to meet several of the guys who are working on projects that I&#8217;m either very interested in or already use.  This includes folks like Juan Sanchez, Doug McCune and Ryan Campbell just to name a few.  It is cool to finally put faces with names after following their blogs for such a long time.</li>
<li>Indianapolis seems to be a pretty clean city and the downtown area is much more lively than I expected.  There are lots of steakhouses and brew pubs.</li>
<li>Renaun&#8217;s presentation on structured log testing is something I can definitely use on my projects at work.  I just hope I can keep the disciplined attitude that it takes to keep my tests up-to-date.</li>
<li>The enhancements coming down the pipe for Flex 4 are even more substantial than I realized.  They will make writing Flex apps much more efficient.  Too bad they are so vague about its availability.</li>
<li>So far, Michael Labriola&#8217;s &#8216;Any Which Array but Loose&#8217; has been my favorite session.  He really seems to know his stuff and I learned a lot about what is really going on in the different types of arrays, vectors, bytearrays and arraycollections.</li>
<li>I think Adobe initially thought that Flash Catalyst would be a great way to create Flex/Flash applications without all the messing coding.  Now that it has been in development for quite some time, I think they&#8217;ve figured out that it is much better to position it as a tool for prototyping and wireframing applications and leaving the rest of the work up to the developers who want to get into the code.</li>
<li>The first night here, Obama was in town.  His motorcade was supposed to pass right by the hotel but I never saw it.  Too bad.  Would have been cool to see the limo and the whole procession first-hand.</li>
<li>Every night there is a reception at the Rock Bottom Brewery.   It is fun to socialize with everyone over a beer after a day of sessions.  The waitresses are pretty good looking too, except for the one that is short, portly, and a dude.</li>
<li>The presentation I&#8217;m most looking forward to is the one on OpenFlux.  The outside-the-box thinking that goes into a project like this is really something else.   The impact that OpenFlux and Degrafa have had on the evolution of Flex 4 is really impressive.</li>
<li>This hotel is also a functioning train station.  The rooms shake when a locomotive rolls through.  They try to pass it off as part of the experience.  My bet is that they just didn&#8217;t think it through.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.billdwhite.com/wordpress/?feed=rss2&amp;p=179</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
