<?xml version="1.0" encoding="iso-8859-1"?>
			<rss version="2.0">
			<channel>
			<title>Derrick Grigg - RIA Developer</title>
			<link>http://www.dgrigg.com</link>
			<description>A blog on Flash, Flex, Coldfusion and RIA development. One part informative, one part helpful and one part sarcastic.</description>
			<language>en-us</language>
            <pubDate>Tue, 06 Jul 2010 12:33:48 -0600</pubDate>
			<item>
				<title>Flex Spark List with custom scroll bar and itemrenderer</title>
				<link>http://www.dgrigg.com/post.cfm/07/06/2010/flex-spark-list-with-custom-scroll-bar-and-itemrenderer</link>
				<guid>http://www.dgrigg.com/post.cfm/07/06/2010/flex-spark-list-with-custom-scroll-bar-and-itemrenderer</guid>
				<description>&lt;p&gt;
	I recently had a request for some help on skinning a Flex 4 Spark List with a custom scroll bar and item renderers. Even though the skinning process has gotten much easier with Flex 4 and the Spark components there is still a learning curve and a few things that are either learned through a lot of trial and error or by having someone point it out to you. Hopefully with this post I will be able to save some other Flex developers the &amp;quot;trial and error&amp;quot; route.&lt;/p&gt;
&lt;p&gt;
	This is the comp of the list that needed to get created. Nothing to complicated at first glance, the standard Spark scroll bar needs to get replaced and a custom itemrenderer will be needed for the list.&lt;/p&gt;
&lt;p&gt;
	&lt;img src=&quot;/samples/listandscrollbar/scrolllist.jpg&quot; /&gt;&lt;/p&gt;
&lt;p&gt;
	So how does one go about turning the image above into a functioning Spark List, follow along.&lt;/p&gt;
&lt;h3&gt;
	Step 1 - Prep the skin pieces&lt;/h3&gt;
&lt;p&gt;
&lt;script src=&quot;/js/swfobject.js&quot;&gt;&lt;/script&gt;	The scroll bar track and thumb from the comp need to be turned into assets that we can use in the Spark skin. The itemrenderer can be completely done with code. If you are familiar with Photoshop turn off the surrounding layers, select the thumb and track, respectively, and then do a &amp;#39;copy merged&amp;#39; and paste each as a new image. Save them as transparent PNG&amp;#39;s that can be embedded into the Flex swf.&lt;/p&gt;
&lt;h3&gt;
	Step 2 - Create the Spark Skins&lt;/h3&gt;
&lt;p&gt;
	Three skins will be required for this task, one for the thumb, the track and the vertical scroll bar (right click, view source on the swf at the bottom to view all the source code).&lt;/p&gt;
&lt;p&gt;
	The track and thumb skins simply embed the pngs that we created in step 1.&lt;/p&gt;
&lt;p&gt;
	The track skin:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
&amp;lt;s:BitmapImage source=&amp;quot;@Embed(&amp;#39;assets/scroll-track.png&amp;#39;, scaleGridLeft=&amp;#39;2&amp;#39;, scaleGridTop=&amp;#39;5&amp;#39;, scaleGridRight=&amp;#39;12&amp;#39;, scaleGridBottom=&amp;#39;275&amp;#39;)&amp;quot; 
				   left=&amp;quot;0&amp;quot;  top=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot; /&amp;gt;
    
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	And the thumb skin:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
&amp;lt;s:BitmapImage source=&amp;quot;@Embed(&amp;#39;assets/scroll-thumb.png&amp;#39;, scaleGridLeft=&amp;#39;1&amp;#39;, scaleGridTop=&amp;#39;5&amp;#39;, scaleGridRight=&amp;#39;13&amp;#39;, scaleGridBottom=&amp;#39;97&amp;#39;)&amp;quot; 
				   left=&amp;quot;0&amp;quot;  top=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	In both cases we use the scale nine attributes to make sure the graphic scales cleanly in the horizontal and vertical directions.&lt;/p&gt;
&lt;p&gt;
	The scroll bar skin sets the skins class for the track and thumb buttons to the new skins we have created.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
&amp;lt;s:Button id=&amp;quot;track&amp;quot; top=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot;  width=&amp;quot;15&amp;quot;
		  focusEnabled=&amp;quot;false&amp;quot;
		  skinClass=&amp;quot;com.dgrigg.skins.VScrollBarTrackSkin&amp;quot; /&amp;gt;

&amp;lt;s:Button id=&amp;quot;thumb&amp;quot; width=&amp;quot;14&amp;quot;
		  focusEnabled=&amp;quot;false&amp;quot; visible.inactive=&amp;quot;false&amp;quot;
		  skinClass=&amp;quot;com.dgrigg.skins.VScrollBarThumbSkin&amp;quot;   /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	That&amp;#39;s it for skin creation.&lt;/p&gt;
&lt;h3&gt;
	Step 3 - Styling via CSS&lt;/h3&gt;
&lt;p&gt;
	Once the skins are created the next step is creating a css file to get the List component to look the way we want. Using css selectors we can tell the List to use the new skin class we have created for the vertical scroll bar on the list. The &amp;#39;fixedThumbSize&amp;#39; style tells the scroll bar if it should adjust the size of the thumb based on the list length. In this case we want the thumb to always be the same size so it gets set to &amp;#39;true&amp;#39;. We have also used CSS to turn off the horiztontal scroll bar, sometimes with custom item renderers the horizontal scroll bar will make an appearance when you don&amp;#39;t want it to.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;s|List 
{
	contentBackgroundAlpha:.5; 
	contentBackgroundColor: #000000;
	borderColor:#000000;
}

s|List #scroller 
{
	horizontalScrollPolicy: off;
}

s|List s|VScrollBar {
	skinClass: ClassReference(&amp;quot;com.dgrigg.skins.VScrollBarSkin&amp;quot;);
	fixedThumbSize:true;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Remember to load the style sheet into the main application class and the new pimped list is ready to go.&lt;/p&gt;
&lt;h3&gt;
	Step 4 - ItemRenderer creation&lt;/h3&gt;
&lt;p&gt;
	The final step in bring the comp to life is creating the ItemRenderer. Fortunately Flex 4 has made this very easy. Navigate to the package you want to create the renderer in and then right click and select &amp;#39;New/MXML Item Renderer&amp;#39;. A basic item renderer will be created that you can begin working with. Here is the code for the item renderer we will be using.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;s:ItemRenderer xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot; 
			xmlns:s=&amp;quot;library://ns.adobe.com/flex/spark&amp;quot; 
			xmlns:mx=&amp;quot;library://ns.adobe.com/flex/mx&amp;quot; 
			autoDrawBackground=&amp;quot;false&amp;quot; height=&amp;quot;85&amp;quot; width=&amp;quot;385&amp;quot;&amp;gt;
&amp;lt;fx:Script&amp;gt;
	&amp;lt;![CDATA[
		
		override public function set data(value:Object):void 
		{
			super.data = value;
			
			if (value)
			{
				titleLbl.text = data.title;
				contentLbl.text = data.text;
				titleLbl.visible = true;
				contentLbl.visible = true;
				readLbl.visible = true;
			}
			else
			{
				titleLbl.text = &amp;quot;&amp;quot;;
				contentLbl.text = &amp;quot;&amp;quot;;
				titleLbl.visible = false;
				contentLbl.visible = false;
				readLbl.visible = false;
			}
			
		}
	]]&amp;gt;
&amp;lt;/fx:Script&amp;gt;
&amp;lt;s:states&amp;gt;
	&amp;lt;s:State name=&amp;quot;normal&amp;quot; /&amp;gt;
	&amp;lt;s:State name=&amp;quot;hovered&amp;quot; /&amp;gt;
	&amp;lt;s:State name=&amp;quot;selected&amp;quot; /&amp;gt;
&amp;lt;/s:states&amp;gt;

&amp;lt;s:Rect left=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot; top=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot;&amp;gt;
	&amp;lt;s:fill&amp;gt;
		&amp;lt;s:SolidColor color.selected=&amp;quot;0x383c40&amp;quot; color.normal=&amp;quot;0x23252a&amp;quot; color.hovered=&amp;quot;0x383c40&amp;quot;
					  alpha.selected=&amp;quot;0.8&amp;quot; alpha.hovered=&amp;quot;0.5&amp;quot; alpha.normal=&amp;quot;0.8&amp;quot; /&amp;gt;
	&amp;lt;/s:fill&amp;gt;
&amp;lt;/s:Rect&amp;gt;

&amp;lt;s:Label id=&amp;quot;titleLbl&amp;quot; 
		 x=&amp;quot;15&amp;quot; y=&amp;quot;15&amp;quot; 
		 width=&amp;quot;370&amp;quot; color=&amp;quot;0xffffff&amp;quot;/&amp;gt;

&amp;lt;s:Label id=&amp;quot;contentLbl&amp;quot; 
		 x=&amp;quot;15&amp;quot; y=&amp;quot;30&amp;quot; 
		 width=&amp;quot;370&amp;quot; height=&amp;quot;30&amp;quot; 
		 color=&amp;quot;0xeeeeee&amp;quot; fontSize=&amp;quot;11&amp;quot;  /&amp;gt;

&amp;lt;s:Label id=&amp;quot;readLbl&amp;quot; 
		 x=&amp;quot;15&amp;quot; y=&amp;quot;65&amp;quot; 
		 color=&amp;quot;0x336699&amp;quot; color.selected=&amp;quot;0xCCCCCC&amp;quot; 
		 text=&amp;quot;READ MORE&amp;quot; fontSize=&amp;quot;11&amp;quot;/&amp;gt;

&amp;lt;s:Line left=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot; width=&amp;quot;1&amp;quot;&amp;gt;
	&amp;lt;s:stroke&amp;gt;
		&amp;lt;s:SolidColorStroke color=&amp;quot;0x000000&amp;quot;/&amp;gt;
	&amp;lt;/s:stroke&amp;gt;
&amp;lt;/s:Line&amp;gt;

&amp;lt;/s:ItemRenderer&amp;gt;

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	A few things to note in the itemrenderer code. First, the &amp;#39;autoDrawBackground&amp;#39; attribute on the ItemRenderer base class is set to &amp;#39;false&amp;#39;. This turns off the&amp;nbsp; selected/rollover/hover background that normally gets drawn and displayed. The s:Rect instance is used with the state selectors on the color attribute to create custom rollover color/alpha combinations. The normal list will allow you to change the color but you can&amp;#39;t tweak the alpha so this is your best option. Second, the &amp;#39;set data&amp;#39; method was overwritten in order to set the values of the various labels. This is a must step for pretty much any custom item renderer. The overwritten method does a small check to see if the incoming value exists, if not the labels get hidden. This is always a good practice to prevent empty rows from appearing in the list.&lt;/p&gt;
&lt;h3&gt;
	Wrap up&lt;/h3&gt;
&lt;p&gt;
	That&amp;#39;s it. A custom scroll bar and item renderer in four steps. No rocket science, just a little Flex know how. You can view the source code &lt;a href=&quot;http://www.dgrigg.com/samples/listandscrollbar/srcview/index.html&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	And this is the final product, not bad.&lt;/p&gt;
&lt;div id=&quot;flashContent&quot;&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt; swfobject.embedSWF(&quot;http://www.dgrigg.com/samples/listandscrollbar/ListAndScrollBar.swf&quot;, &quot;flashContent&quot;, &quot;400&quot;, &quot;400&quot;, &quot;10.0.0&quot;);  &lt;/script&gt;</description>
				<pubDate>Tue, 06 Jul 2010 13:09:29 -0600</pubDate>
				</item> <item>
				<title>Editable ItemRenderer for Flex 4 Spark List</title>
				<link>http://www.dgrigg.com/post.cfm/06/25/2010/editable-itemrenderer-for-flex-4-spark-list</link>
				<guid>http://www.dgrigg.com/post.cfm/06/25/2010/editable-itemrenderer-for-flex-4-spark-list</guid>
				<description>&lt;p&gt;One of the nice features of the Flex mx:List component is that you can set the renderers to be editable without having to create a new itemrenderer. With the Spark List (s:List) that option is no longer available. Fortunately it is quite easy to create a custom editable itemrenderer for the List.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div id=&quot;flashContent&quot;&gt;&lt;/div&gt; &lt;script src=&quot;/js/swfobject.js&quot;&gt;&lt;/script&gt;  &lt;script type=&quot;text/javascript&quot;&gt; swfobject.embedSWF(&quot;http://www.dgrigg.com/samples/editable-list-itemrenderer/EditableList.swf&quot;, &quot;flashContent&quot;, &quot;500&quot;, &quot;470&quot;, &quot;10.0.0&quot;);  &lt;/script&gt; &lt;p&gt;Select an item in the left column and change the value, you can see the change events being traced out. Right click to view the source code.&lt;/p&gt; &lt;p&gt;There are three steps making an editable itemrenderer for the Spark List component.&lt;/p&gt; &lt;h3&gt;First&lt;/h3&gt; &lt;p&gt;Create a custom itemrenderer with a TextInput and a Label.&lt;/p&gt; &lt;pre&gt;&lt;code&gt; &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt; &amp;lt;s:ItemRenderer xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot; &lt;br /&gt;             xmlns:s=&amp;quot;library://ns.adobe.com/flex/spark&amp;quot; &lt;br /&gt;             xmlns:mx=&amp;quot;library://ns.adobe.com/flex/mx&amp;quot; &lt;br /&gt;             autoDrawBackground=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt; &lt;br /&gt;    &lt;br /&gt;    &amp;lt;s:Label id=&amp;quot;labelDisplay&amp;quot; &lt;br /&gt;           text=&amp;quot;{data.label}&amp;quot;   &lt;br /&gt;           top=&amp;quot;7&amp;quot; bottom=&amp;quot;5&amp;quot; left=&amp;quot;5&amp;quot; right=&amp;quot;3&amp;quot;/&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;s:TextInput id=&amp;quot;inputTxt&amp;quot;  &lt;br /&gt;              visible=&amp;quot;false&amp;quot;  &lt;br /&gt;              top=&amp;quot;1&amp;quot;  bottom=&amp;quot;1&amp;quot; left=&amp;quot;1&amp;quot; right=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt;    &lt;br /&gt; &amp;lt;/s:ItemRenderer&amp;gt;&lt;br /&gt;  &lt;/code&gt;&lt;/pre&gt; &lt;h3&gt;Second&lt;/h3&gt; &lt;p&gt;In order to toggle between the read and write states we need to add a click handler to the label and focusOut handler to the text input. You will notice that I simply set the respecitive components to either visible or not instead of uses the spark states. Using the spark states would require extending the list component to include an editHover state and for this example I wanted to keep things simple.  &lt;/p&gt;  &lt;pre&gt;&lt;code&gt; &amp;lt;fx:Script&amp;gt;&lt;br /&gt;   &amp;lt;![CDATA[&lt;br /&gt; 	 import spark.components.supportClasses.ListBase;&lt;br /&gt; 	 &lt;br /&gt; 	 private function onChange(event:Event):void &lt;br /&gt; 	 {&lt;br /&gt; 		isEdit(false);&lt;br /&gt; 		&lt;br /&gt; 	 }&lt;br /&gt; 	 &lt;br /&gt; 	 private function onEdit(event:Event):void &lt;br /&gt; 	 {&lt;br /&gt; 		inputTxt.text = data.label;&lt;br /&gt; 		isEdit(true);&lt;br /&gt; 		//set cursor postion to end&lt;br /&gt; 		inputTxt.selectRange(inputTxt.text.length,inputTxt.text.length+1);&lt;br /&gt; 		inputTxt.setFocus();&lt;br /&gt; 	 }&lt;br /&gt; 	 &lt;br /&gt; 	 private function isEdit(value:Boolean):void &lt;br /&gt; 	 {&lt;br /&gt; 		labelDisplay.visible = !value;&lt;br /&gt; 		inputTxt.visible =  value;&lt;br /&gt; 	 }&lt;br /&gt; 	 &lt;br /&gt;   &lt;br /&gt;   ]]&amp;gt;&lt;br /&gt; &amp;lt;/fx:Script&amp;gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &amp;lt;s:Label id=&amp;quot;labelDisplay&amp;quot; &lt;br /&gt; 	  text=&amp;quot;{data.label}&amp;quot;   &lt;br /&gt; 	  click=&amp;quot;onEdit(event)&amp;quot; &lt;br /&gt; 	  top=&amp;quot;7&amp;quot; bottom=&amp;quot;5&amp;quot; left=&amp;quot;5&amp;quot; right=&amp;quot;3&amp;quot;/&amp;gt;&lt;br /&gt; &lt;br /&gt; &amp;lt;s:TextInput id=&amp;quot;inputTxt&amp;quot;  &lt;br /&gt; 		 visible=&amp;quot;false&amp;quot;  &lt;br /&gt; 		 focusOut=&amp;quot;onChange(event)&amp;quot;&lt;br /&gt; 		 top=&amp;quot;1&amp;quot;  bottom=&amp;quot;1&amp;quot; left=&amp;quot;1&amp;quot; right=&amp;quot;0&amp;quot;/&amp;gt;&lt;br /&gt; &lt;br /&gt; &lt;/code&gt;&lt;/pre&gt; &lt;h3&gt;Third&lt;/h3&gt; &lt;p&gt;This is the not so obvious step. You need to manually dispatch an event through the List&apos;s dataProvider in order to notify the List and anything else that is using the data source that it&apos;s contents have changed.&lt;/p&gt; &lt;pre&gt;&lt;code&gt;private function onChange(event:Event):void &lt;br /&gt; {&lt;br /&gt; &lt;br /&gt; var oldValue:String = labelDisplay.text;&lt;br /&gt; &lt;br /&gt; if (oldValue != inputTxt.text)&lt;br /&gt; {&lt;br /&gt;    data.label = inputTxt.text;&lt;br /&gt;    labelDisplay.text = inputTxt.text;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    //dispatch the data update event&lt;br /&gt;    var list:ListBase = this.owner as ListBase;&lt;br /&gt;    list.dataProvider.itemUpdated(data, &apos;label&apos;, oldValue, inputTxt.text); &lt;br /&gt; }&lt;br /&gt; isEdit(false);&lt;br /&gt; &lt;br /&gt; }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And that&apos;s it. A basic editable list itemrenderer for the Spark List in 3 easy steps. Right click on the swf to see the source code. &lt;/p&gt; 	 </description>
				<pubDate>Fri, 25 Jun 2010 09:40:22 -0600</pubDate>
				</item> <item>
				<title>Developing Flash and Flex applications for Android</title>
				<link>http://www.dgrigg.com/post.cfm/06/23/2010/Developing-Flash-applications-for-Android</link>
				<guid>http://www.dgrigg.com/post.cfm/06/23/2010/Developing-Flash-applications-for-Android</guid>
				<description>&lt;p&gt;Since Apple kiboshed Adobe&apos;s hopes of iPhones running Flash content, Android (Google) has stepped up and offered Flash and Flex developers a mobile platform to development and deliver content on. This has come as great news to Flash platform developers who want the opportunity to dive into the mobile environment. Many Flash (and Flex) developers I have spoken to about mobile development are still unsure about what it will take to deliver Flash player based content and applications to mobile devices.&lt;/p&gt;&lt;p&gt;The good news is the development and delivery process is almost identical to the current process. Use Flash or Flash Builder to create a swf file and then either deploy that to a website, to be served up via an HTML page or wrap it with the AIR runtime and packge it for installation on an Android phone as an native Android installer.&amp;nbsp; Really the only difference in developing for the Android platform is the extra step required to create an &apos;.apk&apos; file if you want to create a stand alone application.&lt;/p&gt;&lt;p&gt;The bad news is the environment that the content and applications are running in is quite different from anything the vast majority of Flash platform developers have worked in. The screen is small, the bulk of user interactions are touch based, the screen can easily be rotated and tilted, the user is often quickly looking at the screen while interacting with the environment around them (ie texting and walking at the same time) and the processor doesn&apos;t have the juice most modern desktops and laptops have. This means that while the swf delivery and development process is quite familar the UI and UX development is anything but. Add in the processing constraints and most Flash platform developers will quickly realize there is a significant learning curve to developing Flash and Flex content for Android (and mobile in general) devices.&lt;/p&gt;&lt;h3&gt;So what are the key areas developers need to be aware of?&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Screen size&lt;/li&gt;&lt;li&gt;User interaction&lt;/li&gt;&lt;li&gt;Device capabilities&lt;/li&gt;&lt;li&gt;Performance&lt;/li&gt;&lt;/ol&gt;&lt;h3&gt;1. Size, it really does matter&lt;/h3&gt;&lt;p&gt;Below are two screen shots of the same Flash application running on a Google Nexus One and a normal desktop computer. The application is 480 x 800. The first image shows the screen as seen on a normal desktop computer with the screen resolution set at 1280 x 1024 (fairly standard desktop resolution). The second image shows the same screen scaled to the physical size as seen on the Nexus screen. It might seem obvious that the mobile screen will be smaller than the desktop screen but watch how screen resolution affects something that is the &amp;quot;same&amp;quot; size. &lt;/p&gt;&lt;h4&gt;Desktop screen shot &lt;br /&gt;&lt;/h4&gt;&lt;p&gt;&lt;img alt=&quot;Flex Android app on desktop&quot; height=&quot;800&quot; src=&quot;http://www.dgrigg.com/images/android-screen.jpg&quot; title=&quot;Flex app on Android&quot; width=&quot;480&quot; /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;h4&gt;Android (Nexus One) screen shot&lt;/h4&gt;&lt;p&gt;&amp;nbsp;&lt;img height=&quot;367&quot; src=&quot;http://www.dgrigg.com/images/android-screen-physical.jpg&quot; title=&quot;Flash application on Android&quot; width=&quot;220&quot; /&gt;&lt;/p&gt;&lt;p&gt;As you can see there is a huge difference in the physical size of the two screens even though the application is viewed at 480 x 800 pixels on both devices. Mobile devices have much higher screen resolutions than normal computers, 240dpi vs 72dpi. As you can see from the images above this makes a huge difference.&amp;nbsp;&lt;/p&gt;&lt;p&gt;For mobile applications this has two very big implications. &lt;/p&gt;&lt;p&gt;First a smaller screen with a much higher resolution means you have much less physical real estate to work with when laying out the user interface. Designers need to be acutely aware of this when creating screens and views. Add in the fact the users are often quickly glancing at the screen which means screens can not afford any clutter and designers have a difficult task in packing a lot of meaningful content into a very small area. &lt;/p&gt;&lt;p&gt;Second, since everything appears much smaller on mobile screens things like text and UI controls (button, checkboxes, etc) need to made larger for readability and clickability (if a beer company can use drinkability I can use clickability). On a mobile device the main pointer is the finger tip which is a lot larger and less precise than a mouse pointer. In a desktop application the typical button size is around 25 pixels in height, on a mobile device 60 pixels is the norm, anything smaller than that and it becomes very challenging to click the button you want.&lt;/p&gt;&lt;p&gt;I couldn&apos;t help but be reminded of this Simpson&apos;s clip after my first experiments building a Flash application for the Android.&lt;/p&gt;&lt;object height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/8DtbPOXFk00&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; width=&quot;480&quot; height=&quot;385&quot; src=&quot;http://www.youtube.com/v/8DtbPOXFk00&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;&quot; allowscriptaccess=&quot;always&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This leads to my second point.&lt;/p&gt;&lt;h3&gt;2. User interaction, it&apos;s all about the finger&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Apple and the iPhone ushered in a whole new era of computer interaction. Sure &apos;touch&apos; has been around for a &lt;a href=&quot;http://en.wikipedia.org/wiki/Touchscreen&quot;&gt;long time&lt;/a&gt;, but it was Apple who made it mainstream. Point and click are things of the past, now it&apos;s point, flip, swipe, pinch, wipe. Sounds more like a heated game of rock-paper-scissors. The great news for Flash platform developers is that AS3 has full &lt;a href=&quot;http://www.adobe.com/devnet/flash/articles/multitouch_gestures_02.html&quot;&gt;gesture support&lt;/a&gt; built in and ready to be used. Events are dispatched for a multitude of user gestures including tapping, swiping and rotating. AS3 also supports multi touch for instances where multiple touch points need to be tracked.&amp;nbsp;&lt;/p&gt;&lt;p&gt;This is a whole new territory for Flash and Flex developers, we generally just interact with the mouse and keyboard, a few of us (myself included) have developed for larger touch screens, but not small mobile screens. Fortunately there is some good information to be found on designing for human interaction. Google has provided some &lt;a href=&quot;http://developer.android.com/guide/practices/ui_guidelines/index.html&quot;&gt;guidelines&lt;/a&gt; for user interface design and Apple has some really good (and thorough) documentation on &lt;a href=&quot;http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/mobilehig/Introduction/Introduction.html#//apple_ref/doc/uid/TP40006556-CH1-SW1&quot;&gt;Human Interface&lt;/a&gt; design. &lt;/p&gt;&lt;p&gt;This is an area that will make or break an application. It won&apos;t matter how great the apps processes information or what information it displays or what it allows users to do, if the control is non-intutive and confusing users will drop it faster than a hot potato (and they may just throw their phone).&lt;/p&gt;&lt;h3&gt;3. Device Capabilities, the swiss army knives of personal computing&lt;/h3&gt;&lt;p&gt;Most mobile devices have as many sensors and media inputs as swiss army knives have blades. There are GPS sensors, accelerometers, touch screens, cameras, microphones, video cameras, scroll balls, the list goes on. The trick for developers is figuring out how to leverage the various sensor inputs (and outputs) to create unique and pleasant user experiences. &lt;/p&gt;&lt;p&gt;For the Flash and Flex developer most (if not all) of these sensors will be available to AIR based applications and most of them will be available to browser based swfs. This an area where Flash applications will really be able to shine. Flash has supported &lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html&quot;&gt;camera&lt;/a&gt; and &lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Video.html&quot;&gt;video&lt;/a&gt; input for a long time, working with these types of media inputs should be second nature to many Flash platform developers. Some of the other sensor inputs are new (ie &lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sensors/Accelerometer.html?allClasses=1&quot;&gt;accelerometer&lt;/a&gt;, &lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Microphone.html&quot;&gt;microphone&lt;/a&gt; and &lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sensors/Geolocation.html?allClasses=1&quot;&gt;gps&lt;/a&gt;) but Flash has the advantage of being able to access and use them, sorry HTML5 and javascript.&lt;/p&gt;&lt;p&gt;Personally I think Flash is uniquely positioned to offer mobile users amazing experiences based on the capabilities of the devices. Flash has been used for years to create amazing, immersive, media rich user experiences. With increased ways to receive and provide feedback between the user and device who knows what applications will start to look like and how they will function.&lt;/p&gt;&lt;h3&gt;4. Performance, where the rubber meets the road&lt;/h3&gt;&lt;p&gt;Performance, performance, performance. This is &amp;quot;allegedly&amp;quot; why Apple doesn&apos;t offer Flash on the iPhone/iPad. I don&apos;t buy it. I have seen Flash running on Android devices first hand, both in the browser and as stand alone applications and trust me it runs perfectly. Adobe has worked very closely with mobile manufacturers to provide hardware acceleration, reduce battery usage and deliver maximum performance with the upcoming &lt;a href=&quot;http://labs.adobe.com/technologies/flashplayer10/&quot;&gt;Flash 10.1 release&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;The critical issue for developers is to remember they are developing for devices that don&apos;t have the same processing resources of typical desktop and laptop computers. Special attention needs to be paid to optimizing performance as much as possible. Grant Skinner has a great presentation on &lt;a href=&quot;http://gskinner.com/talks/quick/&quot;&gt;Flash performance&lt;/a&gt;, where gains can be found and where trouble lurks. &lt;a href=&quot;http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html&quot;&gt;Garbage collection&lt;/a&gt;, &lt;a href=&quot;http://jessewarden.com/2009/02/parsing-rendering-lots-of-data-in-flash-player.html&quot;&gt;green threading&lt;/a&gt;, &lt;a href=&quot;http://www.8bitrocket.com/newsdisplay.aspx?newspage=13430&quot;&gt;blitting&lt;/a&gt; and &lt;a href=&quot;http://www.mikechambers.com/blog/2008/08/19/using-vectors-in-actionscript-3-and-flash-player-10/&quot;&gt;generics&lt;/a&gt; are all areas that AS3 developers should understand in order to optimize and maximize the performance Flash can deliver. &lt;/p&gt;&lt;p&gt;The old computer mantra is &amp;quot;garbage in ...garbage out&amp;quot;. If your application runs slow, freezes or crashes, don&apos;t blame the device, virtual machine, Adobe, Google, Android or your mother, first look at your code. This is where the majority of backlash against Flash performance should really be pointed. It&apos;s not the Flash plugin and runtime, it&apos;s the fact that anyone can &amp;quot;develop&amp;quot; a Flash application and many people that do, don&apos;t understand the performance and memory implications of what they are doing. With the ability to release Flash applications and content to mobile devices, Flash will be under increased scrutiny, do the community a favor and write clean, efficient code.&lt;/p&gt;&lt;h3&gt;Where to next?&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Who knows? The mobile environment is like the internet was 10-15 years ago, the wild wild west. A lot of really cool things will get made and a lot of &lt;a href=&quot;http://www.youtube.com/watch?v=nXHrlm5Nk5w&quot;&gt;dogs will come and go&lt;/a&gt;. The only thing I am sure of is that the Flash platform will have a large place in how applications and content get developed, deployed and used. It&apos;s an exciting time for Flash platform developers, especially after all the HTML5/Apple rhetoric. Get a mobile device, get some neat ideas or find someone who has them and build something amazing, I know I will be. &lt;/p&gt;</description>
				<pubDate>Wed, 23 Jun 2010 11:21:44 -0600</pubDate>
				</item> <item>
				<title>Flash is dead? Long live Flash!</title>
				<link>http://www.dgrigg.com/post.cfm/06/03/2010/Flash-is-dead-Long-live-Flash</link>
				<guid>http://www.dgrigg.com/post.cfm/06/03/2010/Flash-is-dead-Long-live-Flash</guid>
				<description>&lt;p&gt;There has been a ton of hype, speculation and news recently regarding Flash&apos;s impending demise. I won&apos;t go into the details because it&apos;s been hashed over repeatedly and I really don&apos;t feel like beating a dead horse.&amp;nbsp;&lt;/p&gt;&lt;p&gt;As a Flash and Flex developer I have a huge vested interest in where the Flash platform goes and whether or not it survives. I stumbled across this video interview with Jesse Freeman (aka the Flash Bum) where he talks about his take on Flash&apos;s future (skip to 10:20). &lt;/p&gt;&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0&quot; height=&quot;412&quot; id=&quot;flashObj&quot; width=&quot;486&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://c.brightcove.com/services/viewer/federated_f9/74425195001?isVid=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot;&gt;&lt;/param&gt;&lt;param name=&quot;flashVars&quot; value=&quot;videoId=88298097001&amp;amp;playerID=74425195001&amp;amp;domain=embed&amp;amp;dynamicStreaming=true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;base&quot; value=&quot;http://admin.brightcove.com&quot;&gt;&lt;/param&gt;&lt;param name=&quot;seamlesstabbing&quot; value=&quot;false&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;swLiveConnect&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&quot; width=&quot;486&quot; height=&quot;412&quot; src=&quot;http://c.brightcove.com/services/viewer/federated_f9/74425195001?isVid=1&quot; flashvars=&quot;videoId=88298097001&amp;amp;playerID=74425195001&amp;amp;domain=embed&amp;amp;dynamicStreaming=true&quot; name=&quot;flashObj&quot; allowscriptaccess=&quot;always&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Personally I think Jesse is mostly correct. Mobile is critical to Flash&apos;s future success and it must keep evolving.&amp;nbsp; &lt;/p&gt;&lt;p&gt;The world is moving to a constantly connected, mobile environment where devices quite different from the traditional desktop/laptop will rule. As someone who has been involved with early development using Flash and Flex technology on mobile devices I can say Adobe has done a good job with their recent push to get Flash running on devices (1000% better than anything Flashlite was), but there is still a lot of work to do. I&apos;m excited and encouraged by the work they have done with industry leaders in the mobile arena via the &lt;a href=&quot;http://www.openscreenproject.org/&quot;&gt;Open Screen Project&lt;/a&gt; and I honestly believe Flash will be a large player in mobile development for the same reason it currently is in the desktop/laptop environment, they give developers a consistent platform to deliver applications and content with across devices, something no other company or open source initiative offers.&amp;nbsp;&lt;/p&gt;&lt;p&gt;For Flash to succeed Adobe needs to keep the platform evolving. I have  worked with Flash (and Actionscript) since Flash 4 was around, over ten  years ago. Today&apos;s Flash is lightyears ahead of anything it was ten  years ago. It has evolved from a simple animation program to something  you can create complex websites and internet applications with. Actionscript is now on it&apos;s third major revision and approaches more traditional languages like C and Java in terms of usefulness and potential. As a developer (in any language) if you sit down and objectively consider what is possible to run in almost any browser today through the Flash plugin it is almost mind blowing the functionality and performance that can be delivered. Things that were only possible a few short years ago in full blown, heavy client applications that needed to be installed on a computer can now be delivered rapidly through the browser, anytime, anywhere. &lt;/p&gt;&lt;p&gt;Jesse seemed a little pessimistic about Adobe&apos;s ability to keep Flash/Actionscript from becoming stagnant and going the way of the Doodoo bird. I&apos;m more optomistic, having seen where Flash, and more importantly Actionscript, was, where it is, and where it&apos;s heading. I think if anything, Adobe will put more focus on Flash and continue to rapidly push it ahead of competing technologies like Silverlight and to a lesser extend HTML5. Actionscript, as it becomes more rounded and powerful, will become more mainstream and entrenched, much like Java has from it&apos;s early days. &lt;/p&gt;&lt;p&gt;In closing, I could list out many of the things you can do with Flash/Flex/Actionscript but the  video below does a nice succinct job and paints a better picture than anything I could say.&lt;/p&gt;&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0&quot; height=&quot;250&quot; id=&quot;flashObj&quot; width=&quot;400&quot;&gt;&lt;/object&gt;&lt;object height=&quot;250&quot; width=&quot;400&quot;&gt;&lt;param name=&quot;allowfullscreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;param name=&quot;movie&quot; value=&quot;http://vimeo.com/moogaloop.swf?clip_id=12228788&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1&quot;&gt;&lt;/param&gt;&lt;embed type=&quot;application/x-shockwave-flash&quot; width=&quot;400&quot; height=&quot;250&quot; src=&quot;http://vimeo.com/moogaloop.swf?clip_id=12228788&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1&quot; allowscriptaccess=&quot;always&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;  </description>
				<pubDate>Thu, 03 Jun 2010 19:50:34 -0600</pubDate>
				</item> <item>
				<title>Updates to Skinnable Minimal Components</title>
				<link>http://www.dgrigg.com/post.cfm/05/12/2010/Updates-to-Skinnable-Minimal-Components</link>
				<guid>http://www.dgrigg.com/post.cfm/05/12/2010/Updates-to-Skinnable-Minimal-Components</guid>
				<description>&lt;p&gt;After a short holiday I have made some updates to the Skinnable Minimal  Components. The ComboBox, List, TextArea, HScrollBar and VScrollBar can  now all be skinned. You can find the source code on &lt;a href=&quot;http://github.com/dgrigg/SkinnableMinimalComponents&quot;&gt;GitHub&lt;/a&gt;. I  have not had time to create embedded image and drawing api versions of  the skins but you can see the basic skinnable versions below. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div id=&quot;SkinUpdate&quot;&gt;&lt;/div&gt;&lt;script src=&quot;/js/swfobject.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; swfobject.embedSWF(&quot;http://www.dgrigg.com/samples/SkinUpdates1.swf&quot;, &quot;SkinUpdate&quot;, &quot;400&quot;, &quot;470&quot;, &quot;10.0.0&quot;);  &lt;/script&gt; &lt;p&gt;The following Minimal Components can now be skinned: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;CheckBox&lt;/li&gt;&lt;li&gt;ComboBox&lt;/li&gt;&lt;li&gt;HSlider/VSlider&lt;/li&gt;&lt;li&gt;HScrollBar/VScrollBar&lt;/li&gt;&lt;li&gt;Label&lt;/li&gt;&lt;li&gt;List&lt;/li&gt;&lt;li&gt;PushButton&lt;/li&gt;&lt;li&gt;Text &lt;/li&gt;&lt;li&gt;TextArea&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;More to come.&lt;/p&gt; </description>
				<pubDate>Wed, 12 May 2010 09:14:14 -0600</pubDate>
				</item> <item>
				<title>Alpha Release of Skinnable Minimal Components</title>
				<link>http://www.dgrigg.com/post.cfm/04/28/2010/Alpha-Release-of-Skinnable-Minimal-Components</link>
				<guid>http://www.dgrigg.com/post.cfm/04/28/2010/Alpha-Release-of-Skinnable-Minimal-Components</guid>
				<description>&lt;p&gt;If anyone has used &lt;a href=&quot;http://www.minimalcomps.com/&quot;&gt;Minimal Components&lt;/a&gt; by Keith Peters you know what a great set of componets they are. The only knock against them was the fact they &lt;a href=&quot;http://www.bit-101.com/blog/?p=2535&quot;&gt;could not be skinned&lt;/a&gt;. Until now. &lt;/p&gt;&lt;p&gt;In order to make the components more flexible from a visual standpoint yet retain the minimal footprint I have developed a basic set of classes for drawing shapes and fills and the required logic to handle skinning was added. If you have worked with Flex 4 or Degrafa it should be quite obvious, after looking at the source code, how the components and skins interact and how skins are created. Using either programmatic (ie drawing api) or embedded images you can now easily skin the Minimal Components to your heart&apos;s desire.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div id=&quot;MarkupDemo&quot;&gt;&lt;/div&gt;&lt;script src=&quot;/js/swfobject.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; swfobject.embedSWF(&quot;http://www.dgrigg.com/samples/SkinMarkupDemo.swf&quot;, &quot;MarkupDemo&quot;, &quot;425&quot;, &quot;200&quot;, &quot;10.0.0&quot;);  &lt;/script&gt; &lt;p&gt;The demo has three sets of the same components. The first set uses the standard components. The second set is skinned with programmatic skins and the third uses embedded pngs. This demo is super light, even with embedded graphics it weights in at 52kb, compare that to well over 500kb for a comparable Flex app. &lt;/p&gt; &lt;p&gt;The main push to add skinning was Adobe&apos;s entrance into the mobile development space. Being involved in the pre release programs for the iPhone and Android packagers it was quickly apparent to any Flex developer involved that Flex is totally not suitable for mobile app development. Note that I said Flex, not Flash. It&apos;s just too heavy and processor intensive. This posses a huge dilema for developers accustomed to having a good set of UI components to build with, for now there is nothing to build with. Components would need to be built from scratch. That&apos;s a huge non starter for most developers. &lt;/p&gt;&lt;p&gt;Adobe is working to address this with the &lt;a href=&quot;http://labs.adobe.com/technologies/flex/mobile/&quot;&gt;Slider&lt;/a&gt; framework however until that is ready for showtime Flex and Flash developers wanting a decent component set to build mobile apps with are left hung out to dry. Minimal Components seemed like a perfect fit. There are a lot of them, 32 by my count, they are very lightweight and very efficient (all a testament to Keith&apos;s skill). The only thing they needed was an easy way to skin them and to separate the view from the core component logic. That&apos;s were I focused my energy.&amp;nbsp;&lt;/p&gt;&lt;p&gt;They are still a work in progress. All the necessary work to handle skinning and associating components and skins has been done. Now the work involves refactoring each component (creating a default skin and removing the drawing logic from the component). Currently the Label, PushButton, Text, HSlider and VSlider have been done (as you can see in the demo). All the other components will get converted. Once all the components are skinnable the next major step is adding gesture support. &lt;/p&gt;&lt;p&gt;If you would like to try out the new skinnable version you can find the source code on &lt;a href=&quot;http://github.com/dgrigg/SkinnableMinimalComponents&quot;&gt;GitHub&lt;/a&gt;. These are still alpha so I&apos;m sure some issues will be uncovered however I want to get this out in the public domain, especially for other Flex and Flash mobile app devs. &lt;/p&gt;&lt;p&gt;Try them out and let me know what you think. &lt;/p&gt;</description>
				<pubDate>Wed, 28 Apr 2010 12:12:28 -0600</pubDate>
				</item> <item>
				<title>When Flex goes on a SlimFast diet</title>
				<link>http://www.dgrigg.com/post.cfm/04/12/2010/When-Flex-goes-on-a-SlimFast-diet</link>
				<guid>http://www.dgrigg.com/post.cfm/04/12/2010/When-Flex-goes-on-a-SlimFast-diet</guid>
				<description>&lt;p&gt;While digging around looking for some info on Keith Peters &lt;a href=&quot;http://code.google.com/p/minimalcomps/&quot;&gt;Minimal Comps&lt;/a&gt; I  stumbled across a great &lt;a href=&quot;http://www.ryancampbell.com/2009/08/26/using-mxml-without-flex-example-and-source/comment-page-1/#comment-2469&quot;&gt;post&lt;/a&gt;  by Ryan Campbell on creating pure Actionscript projects using MXML. Actionscript projects using MXML??? yes that&apos;s right. Using MXML markup you can create classes without all the Flex overhead. This means you get the benefit of clean easy to read MXML without the bulk of Flex. I will admit, I was completely blown away. I love programming in Flex, I find it much easier and quicker to layout components and views using MXML but I&apos;m often conflicted when I factor in the size advantage a plain Actionscript project has over a Flex project. Now you can have the best of both worlds.&lt;/p&gt;&lt;p&gt;Here is what the mxml looks like. &lt;/p&gt; &lt;pre&gt;&lt;code&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt; &amp;lt;comp:Container xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot;  &lt;br /&gt;             xmlns:comp=&amp;quot;com.dgrigg.components.*&amp;quot; &lt;br /&gt;             xmlns:text=&amp;quot;flash.text.*&amp;quot;&lt;br /&gt;             width=&amp;quot;250&amp;quot; height=&amp;quot;200&amp;quot; &lt;br /&gt;             color=&amp;quot;0xdddddd&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;fx:Script&amp;gt;&lt;br /&gt;       &amp;lt;![CDATA[&lt;br /&gt;          [Bindable]&lt;br /&gt;          public var text:String = &apos;Click block to change color&apos;;&lt;br /&gt;          &lt;br /&gt;          private function onClick(event:MouseEvent):void &lt;br /&gt;          {&lt;br /&gt;             var target:Component = event.target as Component&lt;br /&gt;             target.color = Math.random()* 16581375;&lt;br /&gt;             &lt;br /&gt;             text = &apos;Color: #&apos; + target.color.toString(16);&lt;br /&gt;          }&lt;br /&gt;       ]]&amp;gt;&lt;br /&gt;    &amp;lt;/fx:Script&amp;gt;&lt;br /&gt;       &amp;lt;text:TextField id=&amp;quot;tf&amp;quot; &lt;br /&gt;                   x=&amp;quot;20&amp;quot; width=&amp;quot;200&amp;quot; height=&amp;quot;200&amp;quot; &lt;br /&gt;                   text=&amp;quot;{text}&amp;quot;/&amp;gt;&lt;br /&gt;    &lt;br /&gt;       &amp;lt;comp:Component id=&amp;quot;comp1&amp;quot; &lt;br /&gt;                   x=&amp;quot;20&amp;quot; y=&amp;quot;20&amp;quot; width=&amp;quot;200&amp;quot; height=&amp;quot;20&amp;quot; &lt;br /&gt;                   click=&amp;quot;onClick(event)&amp;quot;/&amp;gt;&lt;br /&gt;    &lt;br /&gt;       &amp;lt;comp:Component id=&amp;quot;comp2&amp;quot; &lt;br /&gt;                   x=&amp;quot;20&amp;quot; y=&amp;quot;50&amp;quot; width=&amp;quot;200&amp;quot; height=&amp;quot;40&amp;quot; &lt;br /&gt;                   click=&amp;quot;onClick(event)&amp;quot;/&amp;gt;&lt;br /&gt;    &lt;br /&gt;       &amp;lt;comp:Component id=&amp;quot;comp3&amp;quot; &lt;br /&gt;                   x=&amp;quot;20&amp;quot; y=&amp;quot;100&amp;quot; width=&amp;quot;200&amp;quot; height=&amp;quot;60&amp;quot; &lt;br /&gt;                   click=&amp;quot;onClick(event)&amp;quot;/&amp;gt;&lt;br /&gt;    &lt;br /&gt; &amp;lt;/comp:Container&amp;gt;&lt;br /&gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I looks just like a Flex MXML class but when compiled it&apos;s 12kb vs 532kb (debug version) and 8kb vs 235kb (non-debug version). Wow. If I add the [Bindable] tag, as you can see in the example it adds about 4-6 kb to the non Flex version. &lt;/p&gt; &lt;div id=&quot;FlexLite&quot;&gt;&lt;/div&gt; &lt;script src=&quot;/js/swfobject.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; swfobject.embedSWF(&quot;http://www.dgrigg.com/samples/FlexLite.swf&quot;, &quot;FlexLite&quot;, &quot;250&quot;, &quot;250&quot;, &quot;10.0.0&quot;);  &lt;/script&gt; &lt;p&gt;&lt;a href=&quot;http://www.dgrigg.com/samples/FlexLite/index.html&quot;&gt;Soure code&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Creating a project to do this is super easy. In Flash Builder (Flex Builder) create a new AS3 Project. After the setup is done&lt;/p&gt;&lt;ol&gt;&lt;li&gt;go to the project properties&lt;/li&gt;&lt;li&gt;select Actionscript Build Path&lt;/li&gt;&lt;li&gt;select Library path&lt;/li&gt;&lt;li&gt;Add SWC&lt;/li&gt;&lt;li&gt;Browse to the &apos;framework.swc&apos; in the Flex SDK dir you are using (ie /flex_sdk_4.1.0.14965/frameworks/libs) and select it.&lt;/li&gt;&lt;/ol&gt;Now you are ready to go. To create a new MXML class you may need to a create new File instead of create new MXML component. Just make sure you use the MXML file extension and declare the &apos;fx&apos; namespace &lt;pre&gt;xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot;&lt;/pre&gt;&lt;p&gt;One of the really nice features of coding this way is you can setup event listeners in the MXML just like in Flex, you don&apos;t need to type out addEventListener(onEvent, Event.TYPE) blah blah each time.&lt;/p&gt;&lt;p&gt;As I start working on some projects using this method I&apos;m sure I will be posting some more information. The next step is building out a full blown app with RobotLegs and hopefully Degrafa for the skinning.&amp;nbsp; &lt;/p&gt;</description>
				<pubDate>Mon, 12 Apr 2010 13:33:23 -0600</pubDate>
				</item> <item>
				<title>Flex Spark application background alpha</title>
				<link>http://www.dgrigg.com/post.cfm/03/25/2010/Flex-Spark-application-background-alpha</link>
				<guid>http://www.dgrigg.com/post.cfm/03/25/2010/Flex-Spark-application-background-alpha</guid>
				<description>&lt;p&gt;Sometimes when creating a web based Flex application you want the  background to be transparent or semi-transparent. In Flex 3 this  involved two steps, setting the &apos;backgroundGradientAlphas&apos; property on  the mx:Application to [0,0] or something less than 1 and setting the &apos;wmode&apos;  on the swf to &apos;transparent&apos;. Now with Flex 4 (Spark) it&apos;s not quite so  easy, there is no &apos;backgroundGradientAlphas&apos; style on the  s:Application. &lt;/p&gt;&lt;p&gt;If you want background alpha on the new Spark  Application component you need to create a custom skin and a style to  the spark:Application. It&apos;s surprisingly easy and I actually like this  method because it gives the developer much more freedom in how they  would like to implement background transparency.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; modify  the default application. Add a new style property using the fx:Metadata  tags and tell the application to use the new skin class you are about to  create with the &apos;skinClass&apos; attribute.&lt;/p&gt;&lt;pre&gt;&lt;code&gt; &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt; &amp;lt;s:Application xmlns:fx=&amp;quot;http://ns.adobe.com/mxml/2009&amp;quot; &lt;br /&gt; 			   xmlns:s=&amp;quot;library://ns.adobe.com/flex/spark&amp;quot; &lt;br /&gt; 			   xmlns:mx=&amp;quot;library://ns.adobe.com/flex/mx&amp;quot;&lt;br /&gt; 			   skinClass=&amp;quot;com.dgrigg.skins.ApplicationSkin&amp;quot; &lt;br /&gt; 			   backgroundColor=&amp;quot;0xFFFFFF&amp;quot; &lt;br /&gt; 			   backgroundAlpha=&amp;quot;0&amp;quot;&lt;br /&gt; 			   width=&amp;quot;100%&amp;quot;&lt;br /&gt; 			   height=&amp;quot;100%&amp;quot;&amp;gt;&lt;br /&gt; 	&amp;lt;fx:Metadata&amp;gt;&lt;br /&gt; 		[Style(name=&amp;quot;backgroundAlpha&amp;quot;,type=&amp;quot;Number&amp;quot;,default=&amp;quot;0&amp;quot;)]&lt;br /&gt; 	&amp;lt;/fx:Metadata&amp;gt;&lt;br /&gt; &amp;lt;/s:Application&amp;gt;&lt;br /&gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Step  2:&lt;/strong&gt; set the new &apos;backgroundAlpha&apos; style value to whatever you want in  the s:Application declaration using the &apos;backgroundAlpha&apos; attribute (see  above).&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; create a new version of the default  spark.skins.spark.ApplicationSkin class and change the following section  from this: &lt;br /&gt; &lt;/p&gt; &lt;pre&gt;&lt;code&gt; &amp;lt;s:Rect id=&amp;quot;backgroundRect&amp;quot; left=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot; top=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot;  &amp;gt;&lt;br /&gt; 	&amp;lt;s:fill&amp;gt;&lt;br /&gt; 		&amp;lt;s:SolidColor color=&amp;quot;{getStyle(&apos;backgroundColor&apos;)}&amp;quot; /&amp;gt;&lt;br /&gt; 	&amp;lt;/s:fill&amp;gt;&lt;br /&gt; &amp;lt;/s:Rect&amp;gt;&lt;br /&gt; &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;to  this:&lt;/p&gt; &lt;pre&gt;&lt;code&gt; &amp;lt;s:Rect id=&amp;quot;backgroundRect&amp;quot; left=&amp;quot;0&amp;quot; right=&amp;quot;0&amp;quot; top=&amp;quot;0&amp;quot; bottom=&amp;quot;0&amp;quot;  &amp;gt;&lt;br /&gt; 	&amp;lt;s:fill&amp;gt;&lt;br /&gt; 		&amp;lt;s:SolidColor color=&amp;quot;{getStyle(&apos;backgroundColor&apos;)}&amp;quot; &lt;br /&gt; 		alpha=&amp;quot;{getStyle(&apos;backgroundAlpha&apos;)}&amp;quot; /&amp;gt;&lt;br /&gt; 	&amp;lt;/s:fill&amp;gt;&lt;br /&gt; &amp;lt;/s:Rect&amp;gt;&lt;br /&gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And  remember to set the wmode to transparent on object/embed tag. The great  part about using a custom skin is you are free to implement a  background alpha however you wish, you can do a plain alpha fill, or you  could do something more exotic like a radial or linear alpha fill. &lt;br /&gt; &lt;/p&gt;				 </description>
				<pubDate>Thu, 25 Mar 2010 07:32:21 -0600</pubDate>
				</item> <item>
				<title>Spark NavigatorContent gotcha</title>
				<link>http://www.dgrigg.com/post.cfm/03/22/2010/Spark-NavigatorContent-gotcha</link>
				<guid>http://www.dgrigg.com/post.cfm/03/22/2010/Spark-NavigatorContent-gotcha</guid>
				<description>&lt;p&gt;The release of Flash Builder 4 and the new Spark components means  most Flex developers will be going through the process of discovering  what has changed from Flex 3 to Flex 4. For the most part the changes  are pretty well documented and with a little trial and error things that  used to work and now don&apos;t can be easily adjusted to work again. Over  the next few months as I work on a few projects using Flash Builder 4  and Flex 4 with the new Spark components I will be sharing my  experiences, the tricks I learn and how to avoid the pitfalls I will  undoubtably find myself in.&lt;/p&gt;&lt;p&gt;One of the first pitfalls I have run  across is using the MX navigator containers (ie ViewStack, TabNavigator,  etc). The Spark component set has no corresponding components and due  to differences in the Spark containers you can not simply add a Spark  group to a navigator container like you can an MX container. You need to  wrap the Spark component(s) in a NavigatorContent instance first. It&apos;s a  little cumbersome but I have found that if the view you are creating  will only be used in a navigator container then it&apos;s easiest to simply  have you component/view extend the NavigatorContent class.&lt;/p&gt;&lt;p&gt;There  are some basic demos &lt;a href=&quot;http://blog.flexexamples.com/2009/10/10/using-the-spark-navigatorcontent-container-with-a-halo-accordion-container-in-flex-4/&quot;&gt;here&lt;/a&gt;  and &lt;a href=&quot;http://blog.everythingflex.com/2010/03/09/f3-v-f4-using-viewstack-tabnavigator-and-accordion/comment-page-1/&quot;&gt;here&lt;/a&gt;  on how to use the NavigatorContent in a navigation container. The  problem I ran into was with the creation policy. As you likely know  navigation containers have a creationPolicy property that determines  when the children get created. Ideally you use the default setting which  means the children only get created as needed. The issue I had was in  Flex 3 you could have a creationComplete event listener on the navigator  children and it would only fire once the container was displayed. In  the function called from the event you could access any of the  container&apos;s children as you knew at that point they had all been  created.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Unfortunately in Flex 4 with the Spark components this  no longer holds true. When you use the NavigatorContent class the  creationComplete event is dispatched immediately when the navigation  container (ie ViewStack is added to the stage) however if the  creationPolicy is not set to all, the actual children on the  NavigatorContent have not yet been created and you end up with RTE&apos;s  when referencing the children. To prevent this from happening you need  to listener to a new event, the &apos;&lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/spark/components/SkinnableContainer.html#event:contentCreationComplete&quot;&gt;contentCreationComplete&lt;/a&gt;&apos; event which  only fires once the NavigatorContent becomes visible.&amp;nbsp;&lt;/p&gt;&lt;p&gt;You can quickly see in the demo below how the two differ (right click to view the source). &lt;/p&gt; &lt;div id=&quot;NavigatorContent&quot;&gt;&lt;/div&gt; &lt;script src=&quot;/js/swfobject.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; swfobject.embedSWF(&quot;/samples/NavigatorContent.swf&quot;, &quot;NavigatorContent&quot;, &quot;425&quot;, &quot;300&quot;, &quot;10.0.0&quot;);  &lt;/script&gt;  &lt;p&gt;The MX Views only fire the &apos;creationComplete&apos; when the view is displayed. At that point any children of the view can be accessed. The Spark views however, all fire the &apos;creationComplete&apos; when they are first added to the ViewStack. At that point accessing any child object of the view will throw an error. It&apos;s after the &apos;&lt;a href=&quot;http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/spark/components/SkinnableContainer.html#event:contentCreationComplete&quot;&gt;contentCreationComplete&lt;/a&gt;&apos; that you can access children of the Spark view. It&apos;s a little semantic difference, but it&apos;s a huge headache the first time you run across it. &lt;/p&gt;  </description>
				<pubDate>Mon, 22 Mar 2010 14:58:01 -0600</pubDate>
				</item> <item>
				<title>Stand up, make a sign and take a stand!</title>
				<link>http://www.dgrigg.com/post.cfm/03/16/2010/Stand-up-make-a-sign-and-take-a-stand</link>
				<guid>http://www.dgrigg.com/post.cfm/03/16/2010/Stand-up-make-a-sign-and-take-a-stand</guid>
				<description>&lt;p&gt;&lt;img align=&quot;right&quot; height=&quot;410&quot; src=&quot;http://www.dgrigg.com/images/take-a-stand.png&quot; title=&quot;Stand For Children&quot; width=&quot;196&quot; /&gt;If you live in Massachusetts and are concerned about the education system you should visit &lt;a href=&quot;http://www.standforchildren.org&quot;&gt;Standforchildren.org &lt;/a&gt;. It&apos;s not very often I work with non-profit organizations however this was a really neat project to be involved with. &lt;a href=&quot;http://www.stand.org/&quot;&gt;Stand For Children&lt;/a&gt; wanted to get the message across to legislators in Massachusetts and across the US that childrens&apos; needs and rights regarding public education need to be heard. &lt;/p&gt;&lt;p&gt;The team at Stand For Children wanted people to actively create, post and share virtual signs about their stand for the public education system. Brian from the &lt;a href=&quot;http://theidcorp.com/&quot;&gt;The ID Corp&lt;/a&gt; came up with a great concept and using some Flash and PHP magic I was able to execute it.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Living in Canada it&apos;s an entirely different situation with public education. I was shocked to find out just how different (and not for the better) the US public education system is. Stand for Children has a great team and I hope this campaign and more like it will help pave the way for a more promising future for America&apos;s youth.&lt;/p&gt;&lt;p&gt;So go ahead. &lt;a href=&quot;http://standforchildren.org/&quot; title=&quot;Stand For Children&quot;&gt;Take a stand&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
				<pubDate>Tue, 16 Mar 2010 12:17:26 -0600</pubDate>
				</item> 
			</channel>
			</rss>
			
