<?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>GhostWire Studios</title>
	<atom:link href="http://www.ghostwire.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ghostwire.com/blog</link>
	<description>Flash UI Components</description>
	<lastBuildDate>Sat, 13 Mar 2010 07:32:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Aspire UI Components (Flash ActionScript 3.0) Site License</title>
		<link>http://www.ghostwire.com/blog/archives/aspire-ui-components-flash-actionscript-3-0-site-license/</link>
		<comments>http://www.ghostwire.com/blog/archives/aspire-ui-components-flash-actionscript-3-0-site-license/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 07:32:35 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash Components]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1762</guid>
		<description><![CDATA[We have added a new licensing option for the Aspire UI Components (Flash ActionScript 3.0) toolkit.  For teams with more than 15 developers, this option translates to significant savings.
A Site License grants all developers located at the same site, working for the same organization, the rights to use the toolkit, royalty-free. It doesn&#8217;t matter [...]]]></description>
			<content:encoded><![CDATA[<p>We have added a new licensing option for the <a href="http://www.ghostwire.com/aspireui/">Aspire UI Components</a> (Flash ActionScript 3.0) toolkit.  For teams with more than 15 developers, this option translates to significant savings.</p>
<p>A Site License grants all developers located at the same site, working for the same organization, the rights to use the toolkit, royalty-free. It doesn&#8217;t matter how many developers work at the site, it doesn&#8217;t matter how many projects the developers will be using the toolkit in, and it doesn&#8217;t matter how many copies of your applications get distributed.</p>
<p>A &#8220;Site&#8221; is defined as a single location with the same mailing address. In other words, the developers must work in the same country, city, building, and on the same floor. This entitlement extends to temporary and freelance developers working at the site, as long as they remained engaged by your organization.</p>
<p><!-- --><br />
<strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features of the components include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management.</p>
<p>This is a pure AS3 library with no dependency on the Flex framework.</p>
<p>For more information, please <a href="http://www.ghostwire.com/aspireui/">click here</a>.</p>
<p>You may experiment with the various features by <a href="http://www.ghostwire.com/aspireui/download">downloading the trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/aspire-ui-components-flash-actionscript-3-0-site-license/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Developer Showcase] ActiveCaptain &#8211; The Interactive Cruising Guidebook</title>
		<link>http://www.ghostwire.com/blog/archives/developer-showcase-activecaptain-the-interactive-cruising-guidebook/</link>
		<comments>http://www.ghostwire.com/blog/archives/developer-showcase-activecaptain-the-interactive-cruising-guidebook/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 06:25:34 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1746</guid>
		<description><![CDATA[The developers at ActiveCaptain have been using the Aspire UI Components toolkit for over a year now.  In this article, we take a quick look at their latest Flash web application, an interactive cruising guide.

ActiveCaptain
The application allows boaters to share their knowledge and experience.  Registered members can provide information about fuel pricing, slip [...]]]></description>
			<content:encoded><![CDATA[<p>The developers at <a href="http://www.activecaptain.com">ActiveCaptain</a> have been using the <a href="http://www.ghostwire.com/aspireui/">Aspire UI Components</a> toolkit for over a year now.  In this article, we take a quick look at their latest Flash web application, an interactive cruising guide.</p>
<p><span id="more-1746"></span><br />
<strong>ActiveCaptain</strong><br />
The application allows boaters to share their knowledge and experience.  Registered members can provide information about fuel pricing, slip fees, a favorite anchorage, or some local knowledge, as well as read marina reviews written by other Captains, write reviews, add points of interest, or correct inaccurate information.</p>
<p>Let&#8217;s take a look at some screen shots of the application:</p>
<p><em>pressing and holding down the mouse on the map brings up a contextual popup menu</em><br />
<a href="http://www.ghostwire.com/blog/wp-content/uploads/activecaptain0.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/activecaptain0.png" alt="" title="activecaptain0" width="670" height="420" class="alignleft size-full wp-image-1747" /></a></p>
<p><em>a resizable modal dialog with some common UI controls</em><br />
<a href="http://www.ghostwire.com/blog/wp-content/uploads/activecaptain1.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/activecaptain1.png" alt="" title="activecaptain1" width="670" height="460" class="alignleft size-full wp-image-1749" /></a></p>
<p><em>searching for marinas</em><br />
<a href="http://www.ghostwire.com/blog/wp-content/uploads/activecaptain2.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/activecaptain2.png" alt="" title="activecaptain2" width="670" height="460" class="alignleft size-full wp-image-1751" /></a></p>
<p><!-- --><br />
<strong>Testimonial</strong><br />
The following is what the developers at ActiveCaptain have to say about the Aspire UI Components toolkit:</p>
<p><em>At ActiveCaptain (<a href="http://www.activecaptain.com">www.activecaptain.com</a>) we started re-writing our Interactive Cruising Guidebook over a year ago.  Early on, we decided that there was only one integrated UI toolkit for ActionScript 3 that had enough capability and quality &#8211; and that was the Aspire UI Components. We loved the way it looked and the consistent way of accessing them made coding easy to learn.</p>
<p>Although we started out with simple user-interface needs, it quickly grew to complex scrolling lists with custom multi-line list items, edit-in-place dialogs, tabbed-cards with user-interfaces, and many forms to display.</p>
<p>We&#8217;re exceedingly happy with the results.  There are no coding workarounds or funny kludgy things needed to make it all work.  It&#8217;s all consistent and clean and works very, very well.</p>
<p>All Flash apps would benefit from the Aspire UI Components toolkit.</em></p>
<p><!-- --><br />
<strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features of the components include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management. This is a pure AS3 library with no dependency on the Flex framework. You may experiment with the various features by <a href="http://www.ghostwire.com/aspireui/download">downloading the trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/developer-showcase-activecaptain-the-interactive-cruising-guidebook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using AspireUI Components with MDM Zinc 3.0</title>
		<link>http://www.ghostwire.com/blog/archives/using-aspireui-components-with-mdm-zinc-3-0/</link>
		<comments>http://www.ghostwire.com/blog/archives/using-aspireui-components-with-mdm-zinc-3-0/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 22:51:42 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1714</guid>
		<description><![CDATA[MDM Zinc™ 3.0 is a feature-rich Rapid Application Development Tool for turning SWFs into stunning commercial cross-platform desktop applications, screensavers, widgets, CD roms, DVD’s, kiosks and more. The AspireUI AS3 library uses PNG image files for component skinning, and this ease of skinning is a good fit for Zinc™ 3.0 projects, especially if you would [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.multidmedia.com">MDM Zinc™ 3.0</a> is a feature-rich Rapid Application Development Tool for turning SWFs into stunning commercial cross-platform desktop applications, screensavers, widgets, CD roms, DVD’s, kiosks and more. The <a href="http://www.ghostwire.com/aspireui/">AspireUI AS3 library</a> uses PNG image files for component skinning, and this ease of skinning is a good fit for Zinc™ 3.0 projects, especially if you would like to create applications that look like native desktop applications.  The toolkit currently comes with four component themes &#8211; &#8220;classic&#8221;, &#8220;xp&#8221;, &#8220;vista&#8221; and &#8220;graylic&#8221;.  The first three aforementioned themes are Windows OS lookalike themes.  </p>
<p>In this short tutorial, we will look at how you can use the AspireUI library in Zinc™ 3.0 projects, and how you can easily swap component themes by simply changing one line of code.</p>
<p><span id="more-1714"></span></p>
<p><strong>mdm.Application.path</strong><br />
When using Zinc™ 3.0, it is important to remember that relative paths to external assets do not work well.  To ensure that your Zinc™ 3.0 compiled applications work as expected, you should always prefix paths with <code>mdm.Application.path</code> so that the application knows where to look for external assets (to be loaded during run-time).</p>
<p>When using the AspireUI library in a normal Flash AS3 project, we would usually initialize the uiSkins manager as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">uiSkins.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;default&quot;</span>, <span style="color: #ff0000;">&quot;assets/skins/&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// use &quot;default&quot; theme folder from the relative path &quot;assets/skins/&quot;</span></pre></div></div>

<p>When coding for Zinc™ 3.0 projects, the following will be used:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">uiSkins.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;default&quot;</span>, mdm.<span style="color: #006600;">Application</span>.<span style="color: #006600;">path</span> + <span style="color: #ff0000;">&quot;assets/skins/&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Likewise, in order for the uiImage class to work properly in Zinc™ 3.0 applications, the following path must be set:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">uiImage.<span style="color: #006600;">path</span> = mdm.<span style="color: #006600;">Application</span>.<span style="color: #006600;">path</span> + <span style="color: #ff0000;">&quot;assets/images/&quot;</span>;</pre></div></div>

<p>That will make it possible for <code>uiImage</code> instances to load from the &#8220;assets/images/&#8221; folder.  For example, the following will create a uiImage instance with image source loaded from &#8220;assets/images/icon.png&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> imgIcon:uiImage = <span style="color: #000000; font-weight: bold;">new</span> uiImage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;icon.png&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><strong>MyZincApp Class</strong><br />
Let&#8217;s now look at a simple <code>MyZincApp</code> class:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">containers</span>.<span style="color: #006600;">uiScrollPane</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">containers</span>.<span style="color: #006600;">uiWindow</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">controls</span>.<span style="color: #006600;">uiImage</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">enums</span>.<span style="color: #006600;">WINDOW</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">managers</span>.<span style="color: #006600;">uiCursors</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">managers</span>.<span style="color: #006600;">uiSkins</span>;
	<span style="color: #0066CC;">import</span> mdm.<span style="color: #66cc66;">*</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyZincApp <span style="color: #0066CC;">extends</span> Sprite 
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyZincApp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span><span style="color: #66cc66;">&#41;</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">else</span> addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ADDED_TO_STAGE</span>, init<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span>evt:Event = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			removeEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ADDED_TO_STAGE</span>, init<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// in order to work with Zinc, we need to specify</span>
			<span style="color: #808080; font-style: italic;">// correct paths to external assets</span>
			uiSkins.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;default&quot;</span>, mdm.<span style="color: #006600;">Application</span>.<span style="color: #006600;">path</span> + <span style="color: #ff0000;">&quot;assets/skins/&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			uiImage.<span style="color: #006600;">path</span> = mdm.<span style="color: #006600;">Application</span>.<span style="color: #006600;">path</span> + <span style="color: #ff0000;">&quot;assets/images/&quot;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// listen to uiSkins manager to get notified when</span>
			<span style="color: #808080; font-style: italic;">// theme assets have been fully loaded</span>
			uiSkins.<span style="color: #006600;">manager</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">INIT</span>, main<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> main<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// ** initializes uiCursors class **</span>
			uiCursors.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// ** initializes uiWindow class **</span>
			uiWindow.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// ** img window **</span>
			<span style="color: #000000; font-weight: bold;">var</span> img:uiImage = <span style="color: #000000; font-weight: bold;">new</span> uiImage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;flower.jpg&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> imgsp:uiScrollPane	= <span style="color: #000000; font-weight: bold;">new</span> uiScrollPane<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			imgsp.<span style="color: #006600;">fillX</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			imgsp.<span style="color: #006600;">fillY</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			imgsp.<span style="color: #006600;">content</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>img<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> imgWin:uiWindow	= <span style="color: #000000; font-weight: bold;">new</span> uiWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			imgWin.<span style="color: #006600;">title</span>		= <span style="color: #ff0000;">&quot;flower.jpg&quot;</span>;
			imgWin.<span style="color: #006600;">content</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>imgsp<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #808080; font-style: italic;">// ** end img window **</span>
&nbsp;
			imgWin.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>After compiling the above class, you will get a SWF that you can then run through the Zinc Builder software to create a desktop application (for Windows, Mac or Linux).  If you run the compiled Zinc application, you will see something like the following:<br />
<a href="http://www.ghostwire.com/blog/wp-content/uploads/MyZincAppXP.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/MyZincAppXP.png" alt="" title="MyZincAppXP" width="606" height="260" class="alignleft size-full wp-image-1716" /></a></p>
<p><strong>Changing Theme I</strong><br />
Now, let&#8217;s see how we can easily change the component theme.  The themes are stored in their respective folders in the &#8220;assets/skins/&#8221; folder.  By changing one line of code, we can switch to using another theme:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">uiSkins.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;vista&quot;</span>, mdm.<span style="color: #006600;">Application</span>.<span style="color: #006600;">path</span> + <span style="color: #ff0000;">&quot;assets/skins/&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>With that, we will now use the &#8220;vista&#8221; theme instead of the default &#8220;xp&#8221; theme.  After re-compiling the SWF and running the new SWF through the Zinc Builder software, we will see something like the following:<br />
<a href="http://www.ghostwire.com/blog/wp-content/uploads/MyZincAppVista.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/MyZincAppVista.png" alt="" title="MyZincAppVista" width="606" height="260" class="alignleft size-full wp-image-1717" /></a></p>
<p><strong>Changing Theme II</strong><br />
Next, we look at how we can change the theme without even changing any code, without re-compiling the SWF, and without re-building the Zinc application. We do this by swapping the contents of the &#8220;default&#8221; folder with the contents from the &#8220;classic&#8221; folder, and then run the Zinc application without re-building.  You will see something like the following:<br />
<a href="http://www.ghostwire.com/blog/wp-content/uploads/MyZincAppClassic.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/MyZincAppClassic.png" alt="" title="MyZincAppClassic" width="606" height="260" class="alignleft size-full wp-image-1718" /></a></p>
<p>The above is possible because by default, the AspireUI library uses run-time skin assets (and is what we are using in this introductory tutorial).  This means that by changing the PNG image assets in the &#8220;assets/skins/default&#8221; folder, you will change the look of your Zinc application.  The library also supports the option to embed the skin assets within the SWF, if so desired.  There is also a tool to package all the skin assets within a folder into one compressed binary file.</p>
<p><strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features of the components include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management. This is a pure AS3 library with no dependency on the Flex framework. You may experiment with the various features by <a href="http://www.ghostwire.com/aspireui/download">downloading the trial version</a>.</p>
<p><strong>MDM Zinc™ 3.0</strong><br />
MDM Zinc™ 3.0, available for Windows and Mac OSX, is the only development tool in its class to offer X-Platform, X-Compile™ to Windows, Mac OSX &#038; Linux Systems. Rapid Application Development for Adobe® Flash® and Flex®.  You may download MDM Zinc™ 3.0 Builder for Windows &#038; Mac OSX at:<br />
<a href="http://www.multidmedia.com/software/zinc/download/">http://www.multidmedia.com/software/zinc/download/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/using-aspireui-components-with-mdm-zinc-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Caps Fonts</title>
		<link>http://www.ghostwire.com/blog/archives/small-caps-fonts/</link>
		<comments>http://www.ghostwire.com/blog/archives/small-caps-fonts/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 11:29:44 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1694</guid>
		<description><![CDATA[In typography, &#8220;small caps&#8221; refer to uppercase (capital) characters used in-lieu of lowercase (small) characters, where these uppercase characters are set at the same height as the lowercase characters.
Small caps are typically used for titles, headlines, column headings, etc.  They are also good for any text that you would usually use all capitals.  [...]]]></description>
			<content:encoded><![CDATA[<p>In typography, &#8220;small caps&#8221; refer to uppercase (capital) characters used in-lieu of lowercase (small) characters, where these uppercase characters are set at the same height as the lowercase characters.</p>
<p>Small caps are typically used for titles, headlines, column headings, etc.  They are also good for any text that you would usually use all capitals.  This is because the use of small caps makes the run of capital letters seem less jarring, and would also often require less space than all caps.</p>
<p>While many word processors and text formatting systems include an option to format text in small caps (which leaves uppercase letters as they are but converts lowercase letters to small caps), this is a feature that is lacking in most graphics editing software.</p>
<p>Some fonts have inherent small caps, ie they use smaller capital letters in place of the lowercase characters.  These fonts are useful when you wish to use small caps to bring distinction to your designs.</p>
<p>Here are some fonts with inherent small caps:</p>
<p><span id="more-1694"></span>The sample text used is:<br />
&#8220;The Quick Brown Fox Jumps Over The Lazy Fox&#8221;</p>
<ul>
<p><!-- --></p>
<li><strong>Berlin Small Caps</strong><br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r16_c6.png" alt="Berlin Small Caps" title="Berlin Small Caps" width="317" height="33" class="alignleft size-full wp-image-1703" /></li>
</li>
<p><!-- --></p>
<li><strong>Copperplate Gothic Bold</strong><br />
<img class="size-full wp-image-1695 alignleft" title="Copperplate Gothic Bold" src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r2_c2.png" alt="Copperplate Gothic Bold" width="439" height="30" />
</li>
<p><!-- --></p>
<li><strong>Copperplate Gothic Light</strong><br />
<img class="alignleft size-full wp-image-1696" title="Copperplate Gothic Light" src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r4_c2.png" alt="Copperplate Gothic Light" width="424" height="29" />
</li>
<p><!-- --></p>
<li><strong>Lithos Pro Regular</strong><br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r6_c4.png" alt="Lithos Pro Regular" title="Lithos Pro Regular" width="434" height="29" class="alignleft size-full wp-image-1698" />
</li>
<p><!-- --></p>
<li><strong>Orator Std</strong><br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r8_c3.png" alt="Orator Std" title="Orator Std" width="457" height="28" class="alignleft size-full wp-image-1699" />
</li>
<p><!-- --></p>
<li><strong>Trajan Pro</strong><br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r10_c5.png" alt="Trajan Pro" title="Trajan Pro" width="456" height="33" class="alignleft size-full wp-image-1700" />
</li>
<p><!-- --></p>
<li><strong>Pericles</strong><br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r12_c8.png" alt="Pericles" title="Pericles" width="436" height="32" class="alignleft size-full wp-image-1701" />
</li>
<p><!-- --></p>
<li><strong>Pericles Light</strong><br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/smallcaps_r14_c7.png" alt="Pericles Light" title="Pericles Light" width="427" height="32" class="alignleft size-full wp-image-1702" /></p>
</ul>
<p><!-- --><br />
Please feel free to leave a comment to mention any other small caps font(s) not listed above.</p>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/small-caps-fonts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>{mdm} 25% Holiday Sale On Zinc 3.0</title>
		<link>http://www.ghostwire.com/blog/archives/mdm-25-holiday-sale-on-zinc-3-0/</link>
		<comments>http://www.ghostwire.com/blog/archives/mdm-25-holiday-sale-on-zinc-3-0/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 11:53:06 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[MDM]]></category>
		<category><![CDATA[Zinc]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1679</guid>
		<description><![CDATA[
If you are looking to compile SWFs into cross-platform desktop applications, leveraging powerful desktop-only APIs, you may want to consider MDM Zinc 3.0.  Available for Windows &#038; Mac OSX, Zinc™ 3.0 is the fastest, most powerful and most feature-rich Rapid Application Development Tool for Adobe® Flash® and Flex®.  With Zinc 3.0, you can [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/boxA_Zinc_Builder_Sml.jpg" alt="boxA_Zinc_Builder_Sml" title="boxA_Zinc_Builder_Sml" width="170" height="220" class="aligncenter size-full wp-image-1681" /></p>
<p>If you are looking to compile SWFs into cross-platform desktop applications, leveraging powerful desktop-only APIs, you may want to consider MDM Zinc 3.0.  Available for Windows &#038; Mac OSX, Zinc™ 3.0 is the fastest, most powerful and most feature-rich Rapid Application Development Tool for Adobe® Flash® and Flex®.  With Zinc 3.0, you can rapidly create stunning commercial Applications, Screensavers, Widgets, CD Roms, DVD&#8217;s, Kiosks and More.</p>
<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/shop_Banner_HolidaySale.jpg" alt="shop_Banner_HolidaySale" title="shop_Banner_HolidaySale" width="570" height="104" class="aligncenter size-full wp-image-1680" /></p>
<p>There is no better time than now to consider picking up Zinc 3.0 &#8211; MDM is currently offering a 25% discount for the following products:</p>
<ul>
<li>Zinc 3.0 Plug-In Windows</li>
<li>Zinc 3.0 Plug-In Mac OSX</li>
<li>Zinc 3.0 Plug-In Linux</li>
<li>Zinc 3.0 Development Suite (contains Windows/Mac OSX/Linux Plug-Ins)</li>
</ul>
<p>Promotion ends 23:59 GMT 30th December 2009.</p>
<p><a href="http://www.multidmedia.com/shop/">http://www.multidmedia.com/shop/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/mdm-25-holiday-sale-on-zinc-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aspire UI Components Trial Version Updated</title>
		<link>http://www.ghostwire.com/blog/archives/aspire-ui-components-trial-version-updated/</link>
		<comments>http://www.ghostwire.com/blog/archives/aspire-ui-components-trial-version-updated/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 16:07:43 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Components]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1669</guid>
		<description><![CDATA[The Trial Version of the Aspire UI library has been updated to v1.3.4 and is now available for download at
http://ghostwire.com/aspireui/download/
* The trial version is strictly for evaluation purposes.
* Compiled SWFs will stop working after a few minutes.
* This trial version is based off Aspire UI Standard Edition v1.3.4.
* Includes the assets for &#8220;classic&#8221;, &#8220;graylic&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<p>The Trial Version of the Aspire UI library has been updated to v1.3.4 and is now available for download at<br />
<a href="http://ghostwire.com/aspireui/download/">http://ghostwire.com/aspireui/download/</a></p>
<p>* The trial version is strictly for evaluation purposes.</p>
<p>* Compiled SWFs will stop working after a few minutes.</p>
<p>* This trial version is based off <a href="http://ghostwire.com/aspireui/docs/changelog">Aspire UI Standard Edition v1.3.4</a>.</p>
<p>* Includes the assets for &#8220;classic&#8221;, &#8220;graylic&#8221; and &#8220;xp&#8221; themes.</p>
<p>* Aspire UI is an ActionScript 3.0 library &#8211; compiled SWFs must target Flash Player 9+.</p>
<p><span id="more-1669"></span><strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management. This is a pure AS3 library with no dependency on the Flex framework.</p>
<p>The AS3 API Reference is available at<br />
<a href="http://ghostwire.com/aspireui/docs/api/">http://ghostwire.com/aspireui/docs/api/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/aspire-ui-components-trial-version-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aspire UI Components: Size of &#8220;classic&#8221;, &#8220;graylic&#8221;, &#8220;vista&#8221; and &#8220;xp&#8221; Themes</title>
		<link>http://www.ghostwire.com/blog/archives/aspire-ui-components-size-of-classic-graylic-vista-and-xp-themes/</link>
		<comments>http://www.ghostwire.com/blog/archives/aspire-ui-components-size-of-classic-graylic-vista-and-xp-themes/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 11:13:04 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash Components]]></category>
		<category><![CDATA[Skinning]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1652</guid>
		<description><![CDATA[The Aspire UI Components library, for pure ActionScript 3.0 development, now ships with four themes &#8211; &#8220;classic&#8221;, &#8220;graylic&#8221;, &#8220;vista&#8221; and &#8220;xp&#8221;.  These themes are included to demonstrate the versatility of the skinning workflow; developers are not limited to these themes but can design their own themes via PNG images.
By default, components in the toolkit [...]]]></description>
			<content:encoded><![CDATA[<p>The Aspire UI Components library, for pure ActionScript 3.0 development, now ships with four themes &#8211; &#8220;classic&#8221;, &#8220;graylic&#8221;, &#8220;vista&#8221; and &#8220;xp&#8221;.  These themes are included to demonstrate the versatility of the skinning workflow; developers are not limited to these themes but can design their own themes via PNG images.</p>
<p>By default, components in the toolkit uses external PNG images loaded during run-time for component skinning.  As of version 1.3, skin assets of the same theme can be compressed and packed into a single binary file, facilitating run-time loading and also making it easy to embed the skin assets if so desired.</p>
<p>As at the time of this post, the sizes of the compressed packed version of the themes are as follows:</p>
<p><span id="more-1652"></span><br />
<strong>&#8220;classic&#8221;</strong><br />
6kb (uncompressed 15kb)<br />
The following is a screenshot of the theme in action:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/aspireui_theme_classic.png" alt="aspireui_theme_classic" title="aspireui_theme_classic" width="446" height="348" class="alignleft size-full wp-image-1654" /></p>
<p><!-- --><br />
<strong>&#8220;graylic&#8221;</strong><br />
8kb (uncompressed 17kb)<br />
The following is a screenshot of the theme in action:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/aspireui_theme_graylic.png" alt="aspireui_theme_graylic" title="aspireui_theme_graylic" width="446" height="348" class="alignleft size-full wp-image-1655" /></p>
<p><!-- --><br />
<strong>&#8220;vista&#8221;</strong><br />
22kb (uncompressed 36kb)<br />
The following is a screenshot of the theme in action:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/aspireui_theme_vista.png" alt="aspireui_theme_vista" title="aspireui_theme_vista" width="446" height="348" class="alignleft size-full wp-image-1656" /></p>
<p><!-- --><br />
<strong>&#8220;xp&#8221;</strong><br />
22kb (uncompressed 30kb)<br />
The following is a screenshot of the theme in action:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/aspireui_theme_xp1.png" alt="aspireui_theme_xp" title="aspireui_theme_xp" width="446" height="348" class="alignleft size-full wp-image-1666" /></p>
<p>Note: sizes may change in the future if more component assets are added to the library.</p>
<p>For more information on packing themes, please refer to:<br />
<a href="http://ghostwire.com/aspireui/docs/skinning/packing-skin-assets">http://ghostwire.com/aspireui/docs/skinning/packing-skin-assets</a></p>
<p><!-- --><br />
<strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features of the components include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management. This is a pure AS3 library with no dependency on the Flex framework.</p>
<p>You may experiment with the various features by <a href="/aspireui/download">downloading the trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/aspire-ui-components-size-of-classic-graylic-vista-and-xp-themes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[AS3] Serializing A Bundle Of Bitmaps As Data Objects</title>
		<link>http://www.ghostwire.com/blog/archives/as3-serializing-a-bundle-of-bitmaps-as-data-objects/</link>
		<comments>http://www.ghostwire.com/blog/archives/as3-serializing-a-bundle-of-bitmaps-as-data-objects/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 14:31:19 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[ByteArray]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1601</guid>
		<description><![CDATA[This post is a supplement to &#8220;Serializing Bitmaps (Storing BitmapData As Raw Binary/ByteArray)&#8221;. In that article, we looked at how to convert BitmapData to a ByteArray, save that ByteArray, and re-construct the BitmapData from the saved ByteArray.
It is important to note that the technique saves the ByteArray &#8220;as is&#8221; in a flat binary file without [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a supplement to <a href="http://www.ghostwire.com/blog/archives/as3-serializing-bitmaps-storing-bitmapdata-as-raw-binarybytearray/">&#8220;Serializing Bitmaps (Storing BitmapData As Raw Binary/ByteArray)&#8221;</a>. In that article, we looked at how to convert <code>BitmapData</code> to a <code>ByteArray</code>, save that <code>ByteArray</code>, and re-construct the <code>BitmapData</code> from the saved <code>ByteArray</code>.</p>
<p>It is important to note that the technique saves the <code>ByteArray</code> &#8220;as is&#8221; in a flat binary file without any header or any block of metadata &#8211; this means that the file will in itself not be able to communicate its data structure and therefore, proper usage of the data requires prior knowledge of how the data has been packed (we used the first four bytes for storing the value of the <code>width</code> of the image).  As a result, that method may be deemed as an &#8220;unorthodox&#8221; hack and unsuitable in team development.</p>
<p>In this post, we look at how you can employ the same basic idea while making the saved data more &#8220;consumable&#8221; by other developers.</p>
<p><span id="more-1601"></span><br />
<strong>Action Message Format (AMF)</strong><br />
ByteArray objects store ActionScript objects using the AMF format.  So instead of saving the binary bitmap data in raw form in the way we described previously, we will put the serialized data in an <code>Object</code> and write that object to a <code>ByteArray</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// assume you have Bitmap object &quot;bitmapImage&quot; you want to save</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// convert the BitmapData to ByteArray</span>
<span style="color: #808080; font-style: italic;">// this time, do not pack any other data in the same ByteArray object</span>
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">data</span>:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">data</span>.<span style="color: #006600;">writeBytes</span><span style="color: #66cc66;">&#40;</span>bitmapImage.<span style="color: #006600;">bitmapData</span>.<span style="color: #006600;">getPixels</span><span style="color: #66cc66;">&#40;</span>bitmapImage.<span style="color: #006600;">bitmapData</span>.<span style="color: #006600;">rect</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// create a new data object</span>
<span style="color: #000000; font-weight: bold;">var</span> bmObj:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
bmObj.<span style="color: #0066CC;">width</span> = bitmapImage.<span style="color: #006600;">bitmapData</span>.<span style="color: #0066CC;">width</span>;
bmObj.<span style="color: #0066CC;">height</span> = bitmapImage.<span style="color: #006600;">bitmapData</span>.<span style="color: #0066CC;">height</span>;
bmObj.<span style="color: #0066CC;">data</span> = <span style="color: #0066CC;">data</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// create a new ByteArray object for saving</span>
<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
bytes.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>bmObj<span style="color: #66cc66;">&#41;</span>;
bytes.<span style="color: #006600;">compress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>So that does it &#8211; you can now save the binary data normally (by posting it to a server script, via AIR local filesystem API, via SharedObject, via FP10 FileReference, etc.).  Although we are still saving our data in a flat binary file, the difference here is that developers consuming the data only need to know that they must read in an <code>Object</code> &#8211; they do not need to have the low-level knowledge of how exactly the data is packed.</p>
<p><!-- --><br />
<strong>ByteArray To BitmapData</strong><br />
Let&#8217;s look at how the binary data can now be consumed in an application.</p>
<p>First, load the file as normal:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> ldr:URLLoader	= <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
ldr.<span style="color: #006600;">dataFormat</span>	= URLLoaderDataFormat.<span style="color: #006600;">BINARY</span>; <span style="color: #808080; font-style: italic;">// ** make sure you do this **</span>
ldr.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, on_fileLoad<span style="color: #66cc66;">&#41;</span>;
ldr.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, on_fileLoadError<span style="color: #66cc66;">&#41;</span>;
ldr.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>pathToBitmapDataFile<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Process the loaded data:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> on_fileLoad<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">type</span> == Event.<span style="color: #006600;">COMPLETE</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = URLLoader<span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">data</span> as ByteArray;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bytes<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				bytes.<span style="color: #006600;">uncompress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// bytes is now the uncompressed byte array</span>
			<span style="color: #808080; font-style: italic;">// ... process bytes ...</span>
			<span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> = bytes.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// obj now has the properties &quot;width&quot;, &quot;height&quot; and &quot;data&quot; as saved previously</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> bmd:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>obj.<span style="color: #0066CC;">width</span>, obj.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// 32 bit transparent bitmap</span>
			bmd.<span style="color: #006600;">setPixels</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">rect</span>, obj.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> bm:Bitmap = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>bmd<span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span>bm<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><!-- --><br />
<strong>Bundle of Bitmaps</strong><br />
What if you have multiple images you want to save and use later?  You can consider serializing the bitmaps and store them together in a single binary file.  To do that, we will give each image a unique id (such as the path of the image file if you are attempting to load and serialize external image files), store the serialized data in a hash, write that hash to a ByteArray, and then write that ByteArray to file.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// for storing the serialized images</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> imgLibrary:<span style="color: #0066CC;">Object</span> = <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#125;</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> saveImage<span style="color: #66cc66;">&#40;</span>id:<span style="color: #0066CC;">String</span>, image:Bitmap<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">||</span> id == <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">return</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>image == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">null</span>; <span style="color: #808080; font-style: italic;">// ** remove previously stored data **</span>
		<span style="color: #b1b100;">return</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">data</span>:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0066CC;">data</span>.<span style="color: #006600;">writeBytes</span><span style="color: #66cc66;">&#40;</span>image.<span style="color: #006600;">bitmapData</span>.<span style="color: #006600;">getPixels</span><span style="color: #66cc66;">&#40;</span>image.<span style="color: #006600;">bitmapData</span>.<span style="color: #006600;">rect</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">// create a new data object</span>
	<span style="color: #000000; font-weight: bold;">var</span> bmObj:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	bmObj.<span style="color: #0066CC;">width</span> = image.<span style="color: #006600;">bitmapData</span>.<span style="color: #0066CC;">width</span>;
	bmObj.<span style="color: #0066CC;">height</span> = image.<span style="color: #006600;">bitmapData</span>.<span style="color: #0066CC;">height</span>;
	bmObj.<span style="color: #0066CC;">data</span> = <span style="color: #0066CC;">data</span>;
&nbsp;
	imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</span> = bmObj; <span style="color: #808080; font-style: italic;">// ** will overwrite previously stored data **</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
saveImage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconA&quot;</span>, imageIconA<span style="color: #66cc66;">&#41;</span>;
saveImage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconB&quot;</span>, imageIconB<span style="color: #66cc66;">&#41;</span>;
saveImage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconC&quot;</span>, imageIconC<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// imgLibrary now contains three data objects each representing an image</span></pre></div></div>

<p>Now, write imgLibrary to file:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// ** must target Flash Player version 10+ **</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> on_buttonClick<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	bytes.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>imgLibrary<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// store width of image</span>
	bytes.<span style="color: #006600;">compress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span>bytes, <span style="color: #ff0000;">&quot;image.bmd&quot;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// default name &quot;image.bmd&quot;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>In another application, we load the saved binary file as usual:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> ldr:URLLoader	= <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
ldr.<span style="color: #006600;">dataFormat</span>	= URLLoaderDataFormat.<span style="color: #006600;">BINARY</span>; <span style="color: #808080; font-style: italic;">// ** make sure you do this **</span>
ldr.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, on_fileLoad<span style="color: #66cc66;">&#41;</span>;
ldr.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>IOErrorEvent.<span style="color: #006600;">IO_ERROR</span>, on_fileLoadError<span style="color: #66cc66;">&#41;</span>;
ldr.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>pathToFile<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>And process and use the loaded binary data as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> imgLibrary:<span style="color: #0066CC;">Object</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> on_fileLoad<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">type</span> == Event.<span style="color: #006600;">COMPLETE</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = URLLoader<span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">data</span> as ByteArray;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bytes<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">try</span>
			<span style="color: #66cc66;">&#123;</span>
				bytes.<span style="color: #006600;">uncompress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// bytes is now the uncompressed byte array</span>
			<span style="color: #808080; font-style: italic;">// ... process bytes ...</span>
			imgLibrary = bytes.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// imgLibrary is now initialized and contains data objects each representing a bitmap image</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>After populating the imgLibrary hash, you can use a method like the one below to query it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getImage<span style="color: #66cc66;">&#40;</span>id:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:Bitmap
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id == <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">||</span> id == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">||</span> imgLibrary == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">||</span> imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</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: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> = imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</span>;
	<span style="color: #0066CC;">try</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// obj now has the properties &quot;width&quot;, &quot;height&quot; and &quot;data&quot; as saved previously</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">var</span> bmd:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>obj.<span style="color: #0066CC;">width</span>, obj.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// 32 bit transparent bitmap</span>
		bmd.<span style="color: #006600;">setPixels</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">rect</span>, obj.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
 		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>bmd<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
getImage<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconA&quot;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// returns a Bitmap with BitmapData constructed from saved byte array</span></pre></div></div>

<p>The <code>getImage()</code> method can also be improved such that the <code>ByteArray-to-BitmapData</code> conversion is only done once per image:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getImage<span style="color: #66cc66;">&#40;</span>id:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:Bitmap
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>id == <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">||</span> id == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">||</span> imgLibrary == <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">||</span> imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</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: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #66cc66;">*</span> = imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</span>;
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj is BitmapData<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>BitmapData<span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">try</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// obj now has the properties &quot;width&quot;, &quot;height&quot; and &quot;data&quot; as saved previously</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">var</span> bmd:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>obj.<span style="color: #0066CC;">width</span>, obj.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// 32 bit transparent bitmap</span>
		bmd.<span style="color: #006600;">setPixels</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">rect</span>, obj.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		imgLibrary<span style="color: #66cc66;">&#91;</span>id<span style="color: #66cc66;">&#93;</span> = bmd;
&nbsp;
 		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Note: If you are confident that the <code>BitmapData</code> is not going to be modified by instances, remove the <code>clone()</code> calls above &#8211; it will save memory since that means all <code>Bitmap</code> instances with the same <code>id</code> will be using the exact same <code>BitmapData</code>.</p>
<p><!-- --><br />
<strong>Embedding Image Asset(s)</strong><br />
After you have saved the binary file, remember that you are not limited to using it only as an external resource &#8211; you can also embed the file into your SWF:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// ActionScript 3.0</span>
<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;assets/images/icons.bin&quot;</span>, mimeType=<span style="color: #ff0000;">&quot;application/octet-stream&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const iconsBundle:<span style="color: #000000; font-weight: bold;">Class</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> imgLibrary:<span style="color: #0066CC;">Object</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> initIcons<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> iconsBundle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as ByteArray;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bytes<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">try</span>
		<span style="color: #66cc66;">&#123;</span>
			bytes.<span style="color: #006600;">uncompress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">catch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:<span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// data not compressed</span>
		<span style="color: #66cc66;">&#125;</span>
		imgLibrary = bytes.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">// imgLibrary is now initialized and contains data objects each representing a bitmap image</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/as3-serializing-a-bundle-of-bitmaps-as-data-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uiWindow: Background Drop Shadow + Glow Effect</title>
		<link>http://www.ghostwire.com/blog/archives/uiwindow-background-drop-shadow-glow-effect/</link>
		<comments>http://www.ghostwire.com/blog/archives/uiwindow-background-drop-shadow-glow-effect/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 16:02:47 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Filters]]></category>
		<category><![CDATA[Flash Components]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Window]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1600</guid>
		<description><![CDATA[The default behavior of the uiWindow container is to cast a drop shadow when it is active in the foreground, and not do so when it is inactive or when it is maximized to fill the stage.  This behavior is determined by the component instance&#8217;s background property value.

Default Shadow
The following is the default background [...]]]></description>
			<content:encoded><![CDATA[<p>The default behavior of the <a href="http://www.ghostwire.com/aspireui/docs/usage/uiwindow">uiWindow</a> container is to cast a drop shadow when it is active in the foreground, and not do so when it is inactive or when it is maximized to fill the stage.  This behavior is determined by the component instance&#8217;s <code>background</code> property value.</p>
<p><span id="more-1600"></span><br />
<strong>Default Shadow</strong><br />
The following is the default <code>background</code> property value for all <code>uiWindow</code> instances:<br />
<code>{shadow_up:0x000000, shadow_up_maximized:-1};</code><br />
That tells the instance it should render a drop shadow of color 0&#215;000000 when its visual state is &#8220;up&#8221;, and not render any drop shadow when its visual state is &#8220;up_maximized&#8221; (when it is maximized, the drop shadow cannot be seen so applying the effect will be pointless).</p>
<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/winxp.png" alt="winxp" title="winxp" width="480" height="416" class="alignleft size-full wp-image-1608" /></p>
<p><!-- --><br />
<strong>Always Cast Drop Shadow</strong><br />
To make a <code>uiWindow</code> instance <em>always</em> cast a drop shadow, you can set its background property as below:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> win:uiWindow = <span style="color: #000000; font-weight: bold;">new</span> uiWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
win.<span style="color: #0066CC;">background</span> = <span style="color: #66cc66;">&#123;</span>shadow:0x000000<span style="color: #66cc66;">&#125;</span>;</pre></div></div>

<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/winxp_always.png" alt="winxp_always" title="winxp_always" width="480" height="416" class="alignleft size-full wp-image-1610" /></p>
<p><!-- --><br />
<strong>Never Cast Drop Shadow</strong><br />
To make a <code>uiWindow</code> instance <em>never</em> cast a drop shadow, you can set its background property to <code>null</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> win:uiWindow = <span style="color: #000000; font-weight: bold;">new</span> uiWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
win.<span style="color: #0066CC;">background</span> = <span style="color: #000000; font-weight: bold;">null</span>;</pre></div></div>

<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/winxp_none.png" alt="winxp_none" title="winxp_none" width="480" height="416" class="alignleft size-full wp-image-1611" /></p>
<p><!-- --><br />
<strong>Glow Effect</strong><br />
As of v1.3.0+, you can also get the <code>uiWindow</code> instance (any <code>uiComponent</code>, actually) to cast a glow effect:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> win:uiWindow = <span style="color: #000000; font-weight: bold;">new</span> uiWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
win.<span style="color: #0066CC;">background</span> = <span style="color: #66cc66;">&#123;</span>glow_up:0x000000, glow_up_maximized:-<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span>;</pre></div></div>

<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/wingraylic_glow.png" alt="wingraylic_glow" title="wingraylic_glow" width="480" height="416" class="alignleft size-full wp-image-1616" /></p>
<p><!-- --><br />
<strong>Drop Shadow + Glow</strong><br />
In the &#8220;vista&#8221; theme, the <code>uiWindow</code> instances use drop shadow + glow effects:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/winvista.png" alt="winvista" title="winvista" width="480" height="416" class="alignleft size-full wp-image-1609" /></p>
<p>See: <a href="http://www.ghostwire.com/blog/archives/aspire-ui-components-theme-vista-released/">&#8220;vista&#8221; themed uiWindow demo</a></p>
<p><!-- --><br />
<strong>Specifying Default uiWindow Background Property</strong><br />
If you wish to override the default background property value, ie set the default value for all <code>uiWindow</code> instances, you can do so by defining it in the theme folder&#8217;s &#8220;rules.xml&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Window</span> <span style="color: #000066;">edge</span>=<span style="color: #ff0000;">&quot;5,5,5&quot;</span> <span style="color: #000066;">slices</span>=<span style="color: #ff0000;">&quot;up,out,up_maximized,out_maximized&quot;</span> <span style="color: #000066;">prefs</span>=<span style="color: #ff0000;">&quot;padding|5|background|shadow_up,0,shadow_up_maximized,-1,glow,0,glowDepth,12,glow_up_maximized,-1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p><!-- --><br />
<strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management. This is a pure AS3 library with no dependency on the Flex framework.</p>
<p>You may experiment with the various features by <a href="/aspireui/download/">downloading the trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/uiwindow-background-drop-shadow-glow-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uiImage: Preloading External Bitmap Images</title>
		<link>http://www.ghostwire.com/blog/archives/uiimage-preloading-external-bitmap-images/</link>
		<comments>http://www.ghostwire.com/blog/archives/uiimage-preloading-external-bitmap-images/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 12:58:14 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Aspire UI]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Components]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=576</guid>
		<description><![CDATA[The uiImage class is used to display an image, the source of which can either be a MovieClip symbol in the library, or an external SWF/GIF/JPG/PNG file.
When using external bitmap images (GIF/JPG/PNG), the uiImage class will load from the external source only once and use cached data if the same source is requested subsequently again [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.ghostwire.com/aspireui/docs/usage/uiimage">uiImage</a> class is used to display an image, the source of which can either be a MovieClip symbol in the library, or an external SWF/GIF/JPG/PNG file.</p>
<p>When using external bitmap images (GIF/JPG/PNG), the <code>uiImage</code> class will load from the external source only once and use cached data if the same source is requested subsequently again by the same or other <code>uiImage</code> instances.  This is efficient because the same <code>BitmapData</code> is used across different <code>uiImage</code> instances that use the same image source.  This is why image icons in Aspire UI scrollable lists do not suffer from the &#8220;flickering&#8221; symptom (which you will experience when using Flash/Flex components).</p>
<p><span id="more-576"></span>The <code>uiImage</code> class does not have any specific API for preloading external bitmap images.  However, you can preload images easily using a dummy <code>uiImage</code> object:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> img:uiImage = <span style="color: #000000; font-weight: bold;">new</span> uiImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">&quot;ImageToPreload.png&quot;</span>;</pre></div></div>

<p>The loading of an external image begins once the &#8220;source&#8221; property is set, even if the <code>uiImage</code> instance is never actually added to the display list.</p>
<p>It may also be worthwhile to note that as of v1.2.4, the <code>uiImage</code> class will load an external resource only once, even if multiple instances request the same resource at the same time before it has been loaded.  In other words, only one connection to an external image source will be made.  Once the image is loaded, all instances using that same source will be updated.</p>
<p><code>uiImage</code> dispatches an <code>Event.CHANGE</code> event when the external image is fully loaded, therefore you can listen to this event to be notified when the (pre)loading has completed.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> img:uiImage = <span style="color: #000000; font-weight: bold;">new</span> uiImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CHANGE</span>, on_imgLoad<span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">&quot;ImageToPreload.png&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> on_imgLoad<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
    evt.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>evt.<span style="color: #0066CC;">type</span>, on_imgLoad<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">// </span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><!-- --><br />
<strong>Aspire UI Components</strong><br />
Aspire UI is a library of Actionscript 3.0 (AS3) classes for building flexible and lightweight UI elements in Adobe Flash applications. Key features include easy skinning using PNG image files, automatic tab focus ordering, CSS text styles, and layout management. This is a pure AS3 library with no dependency on the Flex framework.</p>
<p>You may experiment with the various features by <a href="/aspireui/download/">downloading the trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/uiimage-preloading-external-bitmap-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
