<?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, 28 Aug 2010 08:14:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>On Permutations, Probabilities and Psychology</title>
		<link>http://www.ghostwire.com/blog/archives/on-permutations-probabilities-and-psychology/</link>
		<comments>http://www.ghostwire.com/blog/archives/on-permutations-probabilities-and-psychology/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 08:00:08 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Game Programming]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1875</guid>
		<description><![CDATA[Shuffling an array of items is a common topic in programming, especially as an academic exercise. In my previous post, I wrote about a different approach towards cards shuffling in programming &#8211; which is to not do it. Instead, you can randomly select and remove an item from the array whenever you need to retrieve [...]]]></description>
			<content:encoded><![CDATA[<p>Shuffling an array of items is a common topic in programming, especially as an academic exercise.  In my previous post, I wrote about <a href="http://www.ghostwire.com/blog/archives/game-programming-consider-a-different-approach-to-cards-shuffling/">a different approach towards cards shuffling in programming</a> &#8211; which is to not do it.  Instead, you can randomly select and remove an item from the array whenever you need to retrieve an item.  As far as distribution of probabilities goes, there is no difference between the two methods.</p>
<p>The seemingly controversial topic received some interesting comments.  Due to certain fallacies introduced by a commenter, I thought I should clarify those points for the benefit of any reader who might become confused after reading his comments.  My reply got a little too long, so I am posting it here.</p>
<p><span id="more-1875"></span><br />
<strong>Permutations</strong><br />
pantelis wrote:<br />
<em>&#8220;if you have 2 objects there are 2 possible arrangements of them. If you have 3 there are 6 and if you have 52 there are 52! (1*2*3*…*52). So, the probability of a particular hand (consisting of 52 cards) is 1/52! According to your math the probability of a given sequence is (1/52)^52 which means that there are 52^52 possible arrangements. and that is simply wrong.&#8221;</em></p>
<p>pantelis wrote:<br />
<em>&#8220;your math is wrong. i already gave you a counter proof of that: 52 items can be arranged in 52! ways. this is a fact of life, ever since pascal, bernoulli, and poisson (and their gambling habits) have founded statistics. therefore, the probability of one particular hand (it doesn’t matter which) is 1/52! your math results in (1/52)^52.&#8221;</em></p>
<p>Actually, my math results in 51!.</p>
<p>I never quite understood how pantelis arrived at the 52^52 permutations (he was reminded about &#8220;remaining cards&#8221; and he seems to understand the concept of &#8220;drawing without replacement&#8221;).</p>
<p>When you shuffle an array of 52 items, the number of ways they can be arranged is 52!.</p>
<p>When you randomly select and remove one item from an array until all items have been removed, the number of ways that the items can be arranged is still 52!.</p>
<p>When you randomly select an item from an array without removing it for the next selection, then for a sequence of 52 picks, there are 52^52 permutations.</p>
<p>In any case, for our discussion on &#8220;shuffle and draw from top&#8221; vs &#8220;random pick on demand&#8221;, the number of permutations does not really matter.  It is the distribution of probabilities for each card that matters.</p>
<p><!--more--><br />
<strong>Probabilities</strong><br />
pantelis wrote:<br />
<em>&#8220;we agree that the probability of a particular card be drawn first is 1/52. after the first card is drawn, there is no such thing as “for a card to be drawn as the second card, it must not be drawn as the first card – got that? The chance of that happening is 98.08% (51/52)”. pardon me, but, i haven’t got that.&#8221;</em></p>
<p>pantelis wrote:<br />
<em>&#8220;the probability of a particular card to be drawn second is equal to 1/51, because there is only one favorable outcome (that particular card) and 51 possible outcomes, to be drawn third is 1/50 and so on.&#8221;</em></p>
<p>That is where pantelis went wrong.  That is exactly the misconception I highlighted in <a href="http://www.ghostwire.com/blog/archives/game-programming-consider-a-different-approach-to-cards-shuffling/">the original post</a>.  It is wrong to think that if you randomly pick and remove a card from a deck of 52 cards, the distribution of probabilities will be skewed.</p>
<p>Consider an example.</p>
<p>The probability of a certain card, say Ace of Spades, being drawn as the third card is the compounded probability of three events that MUST occur:<br />
(i) Aces of Spades NOT being drawn as first card (51/52 chance); and<br />
(i) Aces of Spades NOT being drawn as second card (50/51 chance); and<br />
(ii) Aces of Spades bring drawn as third card (1/50 chance).</p>
<p>Therefore, the chance of a particular card (eg. Ace of Spades) being drawn as the third card is<br />
51/52 x 50/51 x 1/50 = 1/52.</p>
<p>pantelis wrote:<br />
<em>&#8220;after the first card is drawn the probability of the second card not been drawn as the first card is 1 (because we are certain that the second card was not drawn first).&#8221;</em></p>
<p>That is a bad twist of words resulting in the wrong framing of the problem at hand, which led to the wrong math.  We are interested in the probability of &#8220;a particular card not being drawn as the first card&#8221;, not &#8220;the second card not being drawn as the first card&#8221;.</p>
<p>pantelis wrote:<br />
<em>&#8220;according to your logic the probability of a particular card been drawn first, second, or last is 1/52… &#8220;</em></p>
<p>Yes, that is exactly what I am saying.</p>
<p>The distribution of probabilities for each card must be statistically fair, and it is.  Whether you shuffle the deck and draw the cards sequentially, or you pick a card at random each time, the distribution of the probabilities remain the same.</p>
<p>Consider the following scenarios:<br />
(i) You take a fresh deck of 52 cards, shuffle it, draw 2 cards from the top of the deck and discard them. What is the chance of the next card drawn (ie 3rd card) from the top of the deck to be Ace of Spades?</p>
<p>(ii) You take a fresh deck of 52 cards, shuffle it, draw 1 card from the top of the deck and discard it. Shuffle the deck again, draw another card from the top of the deck and discard it. Shuffle the deck again. What is the chance of the next card drawn from the top of the deck to be Ace of Spades?</p>
<p>(iii) You take a fresh deck of 52 cards. Now, don’t shuffle it. Let’s ask Paul the Octopus, who is completely innocent and ignorant of the way a fresh deck of cards is prearranged, to truly randomly pick one card from the deck and discard it. Ask him/it to do it again a second time, also completely randomly without bias. What is the chance of the third card Paul picks, truly randomly without bias, from the deck of remaining cards to be Ace of Spades?</p>
<p>The answer: 1/52.  Same for (i), (ii) and (iii).</p>
<p>Now, do the above again, this time revealing the cards as they are drawn.  Assuming that neither the first nor second card is Ace of Spades, what is the chance that the third card would be Ace of Spades?</p>
<p>The answer: 1/50.  Unlike in (i), (ii) and (iii), there is a stipulated condition here that Ace of Spades is not picked as the 1st or 2nd card.</p>
<p>As the above shows, whether you shuffle a deck and then draw from the top, or pick cards at random, or shuffle and reshuffle multiple times, the probability of a particular card being drawn at a particular position remains the same.</p>
<p><!--more--><br />
I hope that clears things up about permutations and probabilities.</p>
<p><!--more--><br />
<strong>Psychology</strong><br />
jason wrote:<br />
<em>&#8220;When shuffling a deck (or multiple decks) of cards in the “real” world (ok, so we don’t live in the Matrix), once the cards are shuffled they stay in that order until they’re dealt (or reshuffled). So randomly picking a card at deal-time does not actually maintain the “reality” of shuffling prior to dealing any cards, though it nets a similar result. Ultimately, I’d agree there’s no serious issue with this, but…it feels “righter” to me to go the pre-shuffle route.&#8221;<br />
</em></p>
<p>jason brought up a completely valid point &#8211; one of psychological barrier.  People get so caught up with &#8220;shuffling&#8221;, that they forgot the real purpose behind it.  It &#8220;feels&#8221; right to go the shuffle route only because that is what we do in the non-digital world.</p>
<p>The reason behind the &#8220;shuffle&#8221; in non-digital games is to introduce randomness.  There was no other way.  Computers can implement their own randomizers, thus my question for the need for a shuffle.  I will also debate that the way computer shuffles an array of cards typically does not maintain the &#8220;reality&#8221; too, because the algorithm will not accurately simulate shuffling by hand.</p>
<p>Does it really matter for cards to stay in a predefined order?  It only serves to give players a false sense of fairness where distribution of &#8220;luck&#8221; is concerned.  It only matters to players who superstitiously believes that shuffling the deck changes the distribution of luck for a given round of game.  When a deck is shuffled, players believe that their &#8220;luck&#8221; is fixed for that round of game.  However, where probabilities are concerned, they remain the same.</p>
<p>The order of the cards will matter to players who can somehow see the sequence of the cards.  But that is akin to hackers who employ memory inspection to see the sequence of a shuffled deck (another reason for not doing shuffles in software).</p>
<p>The only time having cards stay in a predefined order will be for situations where the sequence of the cards is revealed.  But that is also equivalent to picking one card randomly until all cards are drawn and revealed.</p>
<p>I agree that the psychological barrier can be tough to crack.  After all, most people do not define &#8220;luck&#8221; as &#8220;the probability of achieving a favorable outcome&#8221;.</p>
<p>However, the mental beast is one that can be tamed and re-programmed.  In the past, dealers in casinos used to shuffle by hand.  Nowadays, (continuous) shuffling machines are used.  The human touch is missing (where is the &#8220;cut&#8221; which some gamblers believe affects the distribution of luck?), but it has not affected the traffic.  Patrons have been re-programmed to accept the new system.  Likewise for slot machines, the game has been digitized and degenerated to simple presses of a button rather than the pulling of levers.  These changes have warped &#8220;reality&#8221; and have actually made games run faster (and casinos make more money running more games per minute).</p>
<p>The &#8220;reality&#8221; has changed, only because mindsets have.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/on-permutations-probabilities-and-psychology/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[Game Programming] Consider A Different Approach To Cards Shuffling</title>
		<link>http://www.ghostwire.com/blog/archives/game-programming-consider-a-different-approach-to-cards-shuffling/</link>
		<comments>http://www.ghostwire.com/blog/archives/game-programming-consider-a-different-approach-to-cards-shuffling/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 11:54:32 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash AS3]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Game Programming]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1864</guid>
		<description><![CDATA[Very commonly, computer programs (usually games) that have the need to simulate a shuffling of a deck of cards (or drawing a tile from a bag, etc.) will go the obvious way of putting the items in an array, and then randomize the order of the elements of the array. A common algorithm for doing [...]]]></description>
			<content:encoded><![CDATA[<p>Very commonly, computer programs (usually games) that have the need to simulate a shuffling of a deck of cards (or drawing a tile from a bag, etc.) will go the obvious way of putting the items in an array, and then randomize the order of the elements of the array.  A common algorithm for doing that is the<a href="http://en.wikipedia.org/wiki/Knuth_shuffle"> Fisher–Yates</a> shuffle (you can find a suitable implementation easily by googling).</p>
<p>The purpose of this post, however, is not to discuss &#8220;how&#8221; to shuffle arrays.  Rather, I would like to bring up the question of &#8220;why&#8221; (do it) in the first place.</p>
<p><span id="more-1864"></span>In the non-digital world, the shuffling of a deck of cards is mostly necessary given the circumstances &#8211; ie, for convenience.  In a card game, you shuffle the deck of cards to randomize the order of the cards, and players draw from the top (or bottom) of the deck in sequence.  Why do players draw from the top (or bottom) of the deck?  For practical reasons, of course.  Convenience.</p>
<p>Imagine a card game where the game designer decides that players must pick a card randomly from the deck each time they need to draw a card &#8211; the game will end up taking too long to play, drawing cards become tedious, and the game won&#8217;t be very popular.</p>
<p>In both methods of card drawing, the outcome is really the same &#8211; whether you (i) shuffle a deck of cards and then draw from the top of the deck sequentially, or (ii) leave a deck as it is and then randomly pick a card from the deck each time you need to draw a card, the probability of a particular card being drawn by a player is exactly the same.  Let&#8217;s take a look at a deck of 52 cards.  If you shuffle the deck rigorously, the chance of a card being positioned at the location it is shuffled into, and therefore being drawn at that particular position, is 1.92% (1/52).</p>
<p>Now, look at the other scenario.  Leave the deck as it is without shuffling.  When a player randomly picks a card from the deck, the probability of picking a particular card as the first card remains at 1.92% (1/52). What is the probability of a particular card to be drawn as the second card?  A common misconception is that with less cards left, the probability for subsequent cards are now skewed.  Not really.  Let&#8217;s look at the calculations.  First, for a card to be drawn as the second card, it must not be drawn as the first card &#8211; got that?  The chance of that happening is 98.08% (51/52).  Next, the chance of the card being drawn as the second card in the reduced deck of 51 cards is 1.96% (1/51).  The composite probability is&#8230; 51/52 x 1/51 = 1/52, which is still 1.92%!  You can go on to compute for the third card, which is 51/52 x 50/51 x 1/50 = 1/52, and so on.</p>
<p>Okay, we have established that the probability remains the same for both methods of card drawing.  So what?</p>
<p>Well, when it comes to programming, I would debate that it is unnecessary to shuffle a deck of cards.  Players no longer need the convenience here, so why not pick a card at random each time you need to draw a card?  This approach has a couple of advantages:</p>
<p>(i) Preempt cheating by memory peeking.  If you use a shuffled deck, you naturally store the sequence in memory, which means hackers can potentially look at the sequence.  If you generate a random number on demand, picking a card at random each time a card is to be drawn, nobody can have fore-knowledge of what is to come.</p>
<p>(ii) Fast.  You can jump right into a game session without expensive CPU overhead for shuffling arrays.  If you have a large deck, shuffling can be inefficient no matter which algorithm you use.  Instead of shuffling the deck, you just write the code to pick a card randomly from the remaining deck.  Hassle in the non-digital world, fast in the digital version.</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: #000000; font-weight: bold;">function</span> drawNext<span style="color: #66cc66;">&#40;</span>deck:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #66cc66;">*</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> j:uint = deck.<span style="color: #0066CC;">length</span>;
	<span style="color: #000000; font-weight: bold;">var</span> r:uint = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> j;
	<span style="color: #000000; font-weight: bold;">var</span> c:<span style="color: #66cc66;">*</span> = deck<span style="color: #66cc66;">&#91;</span>r<span style="color: #66cc66;">&#93;</span>;
	deck.<span style="color: #0066CC;">splice</span><span style="color: #66cc66;">&#40;</span>r, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// removes item from array</span>
	<span style="color: #b1b100;">return</span> c;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Therefore, when translating a non-digital game into a digital one, take a step back and ponder over whether it is really necessary to implement the rules literally.  As long as the intended outcome (in this case the intended probability of each card being drawn at a certain position) is the same, it would probably be worthwhile exploring more efficient implementations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/game-programming-consider-a-different-approach-to-cards-shuffling/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>FlashDevelop: Getting trace() Statements To Show In Output Panel</title>
		<link>http://www.ghostwire.com/blog/archives/flashdevelop-getting-trace-statements-to-show-in-output-panel/</link>
		<comments>http://www.ghostwire.com/blog/archives/flashdevelop-getting-trace-statements-to-show-in-output-panel/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 08:44:10 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash AS3]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[FlashDevelop]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1860</guid>
		<description><![CDATA[This is quite an obscure, little known, hidden-by-default feature, but the FlashDevelop IDE actually has a built-in Flash tracer. The plug-in is unfortunately not enabled by default, and new users of FlashDevelop often get frustrated wondering where to look for the output of their trace statements. To get the tracer to work: 1) Go to [...]]]></description>
			<content:encoded><![CDATA[<p>This is quite an obscure, little known, hidden-by-default feature, but the <a href="http://www.flashdevelop.org">FlashDevelop</a> IDE actually has a built-in Flash tracer.  The plug-in is unfortunately not enabled by default, and new users of FlashDevelop often get frustrated wondering where to look for the output of their trace statements.</p>
<p>To get the tracer to work:</p>
<p>1) Go to Tools -> Program Settings (F10).</p>
<p>2) In the Plugins list on the left of the dialog box, look for FlashLogViewer and click on it.</p>
<p>3) On the right panel, look for the &#8220;Start Tracking&#8221; property, click on the drop down box and select &#8220;OnBuildComplete&#8221; (it is set to &#8220;Manually&#8221; by default).</p>
<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/flashlogviewer.png" alt="" title="flashlogviewer" width="621" height="489" class="alignleft size-full wp-image-1861" /></p>
<p>The output of your trace statements are now shown in the Output Panel after you build your project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/flashdevelop-getting-trace-statements-to-show-in-output-panel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac OSX Keeps Restarting On Its Own?</title>
		<link>http://www.ghostwire.com/blog/archives/mac-osx-keeps-restarting-on-its-own/</link>
		<comments>http://www.ghostwire.com/blog/archives/mac-osx-keeps-restarting-on-its-own/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 05:32:54 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[mac osx]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1848</guid>
		<description><![CDATA[Ever since I first started using Mac OSX, I have been haunted by this strange behavior. On Windows, if I leave the machine to take a much needed break, or to take a phone call, go for a run, take a shower, etc. I can return to the machine later, with my work-in-progress intact, safe [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I first started using Mac OSX, I have been haunted by this strange behavior.  On Windows, if I leave the machine to take a much needed break, or to take a phone call, go for a run, take a shower, etc. I can return to the machine later, with my work-in-progress intact, safe and sound.  Or downloads in Firefox completed.  Or whatever tasks that were left running, either still running or completed.</p>
<p>On the Mac, I have lost much work and time due to the Mac OSX intrusively restarting on its own.  Drafts not saved?  Say farewell &#8211; lost forever.  Downloads disrupted &#8211; start over (unless resume miraculously works).  This is especially exasperating, considering that Apple requires you to update the iPhone SDK/Xcode by re-downloading the whole package.  Not patching, but re-downloading a 2GB+ file.</p>
<p>So, why exactly is the Mac restarting on its own, even when it is not idle such as having a download-in-progress?</p>
<p>Turns out that this is due to a rather useless Security feature.  Ridiculously, the &#8220;Log out after 30 minutes of inactivity&#8221; setting is the culprit.  So, to save yourself some agony, make sure you turn it off:</p>
<p><a href="http://www.ghostwire.com/blog/wp-content/uploads/mac-autologout.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/mac-autologout.png" alt="" title="mac-autologout" width="667" height="395" class="alignleft size-full wp-image-1852" /></a></p>
<p>If your Mac has been suffering from this problem, hope the above helps!</p>
<p>Seriously, I have no idea what purpose this Security feature serves, other than to make you lose progress in your work.  By comparison, on Windows, if the OS logs you out due to inactivity, it actually restores your session with your work-in-progress intact the next time you log in.  You can even safely switch between user accounts on Windows, and log back into an account with its last session intact.</p>
<p>P/S:  As far as security goes, you should just check the &#8220;Require password&#8221; option.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/mac-osx-keeps-restarting-on-its-own/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>uiImage: Loading Resources From Foreign Domains</title>
		<link>http://www.ghostwire.com/blog/archives/uiimage-loading-resources-from-foreign-domains/</link>
		<comments>http://www.ghostwire.com/blog/archives/uiimage-loading-resources-from-foreign-domains/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 03:33:15 +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[Flash Player Bug]]></category>
		<category><![CDATA[Loader]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1842</guid>
		<description><![CDATA[The uiImage component is used to display an image (JPG/PNG/GIF). The path to the image is specified by the source property. By default, the uiImage object will attempt to load resources from the &#8220;assets/images/&#8221; folder (path is relative to the application SWF). To load from a different path, for example the folder &#8220;resources/images/&#8221;, prefix the [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.ghostwire.com/aspireui/docs/usage/uiimage">uiImage</a> component is used to display an image (JPG/PNG/GIF).  The path to the image is specified by the <code>source</code> property.  By default, the <code>uiImage</code> object will attempt to load resources from the &#8220;assets/images/&#8221; folder (path is relative to the application SWF).  To load from a different path, for example the folder &#8220;resources/images/&#8221;, prefix the source with “url:”, example “url:resources/images/garden.jpg”.</p>
<p>In order to load images from a different domain, the Flash Player will need to read a crossdomain.xml file from the foreign domain (and this file must grant permission to your domain to access the required resources). Typically, you would expect to need to specify a <code>checkPolicyFile</code> property somewhere.  In the case of the <code>uiImage</code> component, there is no <code>checkPolicyFile</code> property to set because this would be unnecessary.</p>
<p><span id="more-1842"></span>In order to load an image from a foreign domain, you would specify the source with a &#8220;url:http://&#8221; prefix.  This prefix is sufficient to let the component know that you are loading from a foreign domain (you would omit the http:// otherwise).</p>
<p>Internally, the <code>uiImage</code> component sets the <code>checkPolicyFile</code> property automatically, as necessary.  The rationale here is that, since the flag must always be <code>TRUE</code> for Flash applications deployed over the web (<code>sandboxType</code> is <code>Security.REMOTE</code>) whenever the Flash Player attempts to load resources from foreign domains, we might as well have the component set this automatically rather than having to expose a superfluous API.  To be very clear, the <code>checkPolicyFile</code> flag is <code>FALSE</code> by default &#8211; the policy file is checked only if the application is deployed over the web (ie application&#8217;s <code>sandboxType</code> is <code>Security.REMOTE</code>), because checking the policy file is unnecessary when deployed on the desktop.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/uiimage-loading-resources-from-foreign-domains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[OSX] Goodbye, Spaces&#8230; Hello, Spark!</title>
		<link>http://www.ghostwire.com/blog/archives/osx-goodbye-spaces-hello-spark/</link>
		<comments>http://www.ghostwire.com/blog/archives/osx-goodbye-spaces-hello-spark/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 09:42:46 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[mac osx]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1827</guid>
		<description><![CDATA[This post may come across as blasphemous to ardent Mac fanatics, but I am hoping that OSX users who are in the same predicament as me may find it useful. I have finally disabled Spaces on Mac OSX. It&#8217;s a little painful to disable it, because I had considered it a very crucial feature, considering [...]]]></description>
			<content:encoded><![CDATA[<p>This post may come across as blasphemous to ardent Mac fanatics, but I am hoping that OSX users who are in the same predicament as me may find it useful.</p>
<p>I have finally disabled Spaces on Mac OSX.  It&#8217;s a little painful to disable it, because I had considered it a very crucial feature, considering that without it the desktop gets cluttered quickly with the way the Mac OS presents applications and their respective windows (all mixed together in one very confusing bucket).  However, the slide animation that occurs every time Spaces switches from one space to another has become really nauseating.</p>
<p>It was cool at first, but now it is painful to watch.</p>
<p>So much for Apple&#8217;s acclaimed emphasis on the &#8220;user experience&#8221;.  Does nobody in the UX team ever stop to think that not everyone likes gimmicky animation stuff for frequent tasks, and there should be an easy way to disable such animations?  Unfortunately, there is just no way to disable the animations &#8211; I hope to be proven wrong, but my searches have come up fruitless.  A <a href="http://www.google.com/search?q=mac+osx+disable+spaces+animation">quick google visit</a> shows there are other users who wish to get rid of the animation too (and apparently I am not the only one suffering from motion sickness, although most simply want to get rid of the animation just to save time, keeping multitasking slick and snappy).</p>
<p>So, now that I have disabled Spaces, what do I do now with the cluttered desktop?  I am currently solving the issue with a little AppleScript and implementation of keyboard shortcuts via <a href="http://www.shadowlab.org/Software/spark">Spark</a> &#8211; a free utility to create Hot Keys to launch applications and documents, execute AppleScript, etc.</p>
<p><span id="more-1827"></span>First, you can use simple AppleScript to hide all other applications except the one you are working on:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">tell application <span style="color: #ff0000;">&quot;Finder&quot;</span>
	<span style="color: #0066CC;">set</span> <span style="color: #0066CC;">visible</span> of every process whose <span style="color: #0066CC;">visible</span> is <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #0066CC;">and</span> frontmost is <span style="color: #0066CC;">not</span> <span style="color: #000000; font-weight: bold;">true</span> to <span style="color: #000000; font-weight: bold;">false</span>
<span style="color: #0066CC;">end</span> tell</pre></div></div>

<p>If you are already using a Hot Key utility to execute other AppleScript, you already know the routine.  If not, you can download <a href="http://www.shadowlab.org/Software/spark">Spark</a>, launch it, and then assign the above AppleScript to a keyboard shortcut.<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/SparkHideOthers.png" alt="" title="SparkHideOthers" width="621" height="550" class="alignleft size-full wp-image-1829" /></p>
<p>(click on the Shortcut input field and then type the keyboard shortcut to assign the Hot Key)</p>
<p>With the above, F1 has been assigned as the Hot Key &#8211; pressing F1 when any application has focus will hide all other windows except the currently active application (or in AppleScript&#8217;s terminology, &#8220;frontmost&#8221; application).</p>
<p>But that only got rid of the clutter, albeit momentarily (as the clutter builds up, I hit F1 again).</p>
<p>What about jumping around applications?  That was what Spaces allowed me to do, and now I need to replicate that functionality.  Luckily, it is easy enough to do that with Spark.  You can once again write AppleScript, such as the following:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">tell application <span style="color: #ff0000;">&quot;Finder&quot;</span>
	<span style="color: #0066CC;">set</span> <span style="color: #0066CC;">visible</span> of every process to <span style="color: #000000; font-weight: bold;">false</span>
<span style="color: #0066CC;">end</span> tell
&nbsp;
tell application <span style="color: #ff0000;">&quot;Xcode&quot;</span>
	activate
	<span style="color: #0066CC;">set</span> <span style="color: #0066CC;">visible</span> to <span style="color: #000000; font-weight: bold;">true</span>
<span style="color: #0066CC;">end</span> tell</pre></div></div>

<p>However, you don&#8217;t even need to do that &#8211; Spark allows you to assign Hot Keys to Applications, so let&#8217;s do that:</p>
<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/SparkApplicationLauncher.png" alt="" title="SparkApplicationLauncher" width="599" height="279" class="alignleft size-full wp-image-1830" /></p>
<p>As you can see, the above assigns Command-F1 to Xcode, and Command-F2 to Firefox.  With that set up, when you are in another application, hitting Command-F1 will jump to Xcode immediately.  If Xcode is not yet launched, it will automatically launch first.  Spark also provides the options for hiding all applications when your desired program is launched:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/SparkLauncherOptions.png" alt="" title="SparkLauncherOptions" width="611" height="368" class="alignleft size-full wp-image-1832" /></p>
<p>So, that is that.  A little manual work to assign frequently used applications to Hot Keys.  But at least it no longer gets dizzy working on Mac OSX now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/osx-goodbye-spaces-hello-spark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uiFrame: ActionScript 3.0 GroupBox</title>
		<link>http://www.ghostwire.com/blog/archives/uiframe-actionscript-3-0-groupbox/</link>
		<comments>http://www.ghostwire.com/blog/archives/uiframe-actionscript-3-0-groupbox/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 09:02:05 +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[Flash Components]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1811</guid>
		<description><![CDATA[It is often overlooked, but the uiFrame component in the Aspire UI toolkit essentially has the same utility as the GroupBox in WPF (Windows Presentation Foundation). A GroupBox displays a border/frame around a group of controls, with or without a caption/title. This is typically done to provide visual feedback to end-users that a collection of [...]]]></description>
			<content:encoded><![CDATA[<p>It is often overlooked, but the <a href="http://www.ghostwire.com/aspireui/docs/usage/uiframe">uiFrame</a> component in the <a href="http://www.ghostwire.com/aspireui/">Aspire UI</a> toolkit essentially has the same utility as the GroupBox in WPF (Windows Presentation Foundation).</p>
<p>A GroupBox displays a border/frame around a group of controls, with or without a caption/title.  This is typically done to provide visual feedback to end-users that a collection of controls on a form is logically grouped.</p>
<p>When using the Aspire UI toolkit in ActionScript 3.0 projects, you can use the uiFrame component for the same results.</p>
<p><span id="more-1811"></span></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: #000000; font-weight: bold;">var</span> fruit0:uiCheckBox = <span style="color: #000000; font-weight: bold;">new</span> uiCheckBox<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Apple&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> fruit1:uiCheckBox = <span style="color: #000000; font-weight: bold;">new</span> uiCheckBox<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Banana&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> fruit2:uiCheckBox = <span style="color: #000000; font-weight: bold;">new</span> uiCheckBox<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Orange&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> fruitsBox:uiBox    = <span style="color: #000000; font-weight: bold;">new</span> uiBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
fruitsBox.<span style="color: #006600;">vertical</span>    = <span style="color: #000000; font-weight: bold;">true</span>;
fruitsBox.<span style="color: #006600;">spacing</span>    = <span style="color: #cc66cc;">4</span>;
&nbsp;
fruitsBox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;You can choose one or more fruits!&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
fruitsBox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>fruit0<span style="color: #66cc66;">&#41;</span>;
fruitsBox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>fruit1<span style="color: #66cc66;">&#41;</span>;
fruitsBox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>fruit2<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> frm:uiFrame = <span style="color: #000000; font-weight: bold;">new</span> uiFrame<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
frm.<span style="color: #006600;">content</span> = fruitsBox;
frm.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">10</span>;
frm.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">10</span>;
&nbsp;
frm.<span style="color: #006600;">title</span> = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Fruits&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
addChild<span style="color: #66cc66;">&#40;</span>frm<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/uiframe_xp.png" alt="" title="uiframe_xp" width="250" height="150" class="alignleft size-full wp-image-1813" /></p>
<p>Using the &#8220;graylic&#8221; theme, the result would be as follows:</p>
<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/uiframe_graylic.png" alt="" title="uiframe_graylic" width="223" height="153" class="alignleft size-full wp-image-1814" /></p>
<p>Notice that the caption (title) is left aligned by default.  You can adjust the alignment by specifying the <code>alignX</code> property:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">frm.<span style="color: #006600;">title</span> = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Fruits&quot;</span><span style="color: #66cc66;">&#41;</span>;
frm.<span style="color: #006600;">title</span>.<span style="color: #006600;">alignX</span> = <span style="color: #0066CC;">ALIGN</span>.<span style="color: #006600;">CENTER</span>;</pre></div></div>

<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/uiframe_xp_center.png" alt="" title="uiframe_xp_center" width="250" height="150" class="alignleft size-full wp-image-1815" /></p>
<p>Using the &#8220;classic&#8221; theme with background set to gray, the result would be as follows:</p>
<p><img src="http://www.ghostwire.com/blog/wp-content/uploads/uiframe_classic.png" alt="" title="uiframe_classic" width="250" height="135" class="alignleft size-full wp-image-1817" /></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/uiframe-actionscript-3-0-groupbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uiColorPicker: Customizing The Colors Palette</title>
		<link>http://www.ghostwire.com/blog/archives/uicolorpicker-customizing-the-colors-palette/</link>
		<comments>http://www.ghostwire.com/blog/archives/uicolorpicker-customizing-the-colors-palette/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 07:08:06 +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[Flash Components]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1784</guid>
		<description><![CDATA[In this post, we look at how the colors palette/swatch of the uiColorPicker control can be customized. By default, the component uses the following set of colors: We can define an alternative colors array for the popup palette: private static const COLORS_CONTINUOUS_TONE:Array = &#91; 0xCCFFFF, 0xCCCCFF, 0xCC99FF, 0xCC66FF, 0xCC33FF, 0xCC00FF, 0xFF00FF, 0xFF33FF, 0xFF66FF, 0xFF99FF, 0xFFCCFF, [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, we look at how the colors palette/swatch of the <a href="http://www.ghostwire.com/aspireui/docs/usage/uicolorpicker">uiColorPicker</a> control can be customized.</p>
<p><span id="more-1784"></span>By default, the component uses the following set of colors:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/uicolorpicker_dropshadow.png" alt="" title="uicolorpicker_dropshadow" width="295" height="250" class="alignleft size-full wp-image-1778" /></p>
<p><!-- --><br />
We can define an alternative <code>colors</code> array for the popup palette:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const COLORS_CONTINUOUS_TONE:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>
0xCCFFFF, 0xCCCCFF, 0xCC99FF, 0xCC66FF, 0xCC33FF, 0xCC00FF, 0xFF00FF, 0xFF33FF, 0xFF66FF, 0xFF99FF, 0xFFCCFF, 0xFFFFFF,
0xCCFFCC, 0xCCCCCC, 0xCC99CC, 0xCC66CC, 0xCC33CC, 0xCC00CC, 0xFF00CC, 0xFF33CC, 0xFF66CC, 0xFF99CC, 0xFFCCCC, 0xFFFFCC,
0xCCFF99, 0xCCCC99, 0xCC9999, 0xCC6699, 0xCC3399, 0xCC0099, 0xFF0099, 0xFF3399, 0xFF6699, 0xFF9999, 0xFFCC99, 0xFFFF99,
0xCCFF66, 0xCCCC66, 0xCC9966, 0xCC6666, 0xCC3366, 0xCC0066, 0xFF0066, 0xFF3366, 0xFF6666, 0xFF9966, 0xFFCC66, 0xFFFF66,
0xCCFF33, 0xCCCC33, 0xCC9933, 0xCC6633, 0xCC3333, 0xCC0033, 0xFF0033, 0xFF3333, 0xFF6633, 0xFF9933, 0xFFCC33, 0xFFFF33,
0xCCFF00, 0xCCCC00, 0xCC9900, 0xCC6600, 0xCC3300, 0xCC0000, 0xFF0000, 0xFF3300, 0xFF6600, 0xFF9900, 0xFFCC00, 0xFFFF00,
0x66FF00, 0x66CC00, 0x669900, 0x666600, 0x663300, 0x660000, 0x990000, 0x993300, 0x996600, 0x999900, 0x99CC00, 0x99FF00,
0x66FF33, 0x66CC33, 0x669933, 0x666633, 0x663333, 0x660033, 0x990033, 0x993333, 0x996633, 0x999933, 0x99CC33, 0x99FF33,
0x66FF66, 0x66CC66, 0x669966, 0x666666, 0x663366, 0x660066, 0x990066, 0x993366, 0x996666, 0x999966, 0x99CC66, 0x99FF66,
0x66FF99, 0x66CC99, 0x669999, 0x666699, 0x663399, 0x660099, 0x990099, 0x993399, 0x996699, 0x999999, 0x99CC99, 0x99FF99,
0x66FFCC, 0x66CCCC, 0x6699CC, 0x6666CC, 0x6633CC, 0x6600CC, 0x9900CC, 0x9933CC, 0x9966CC, 0x9999CC, 0x99CCCC, 0x99FFCC,
0x66FFFF, 0x66CCFF, 0x6699FF, 0x6666FF, 0x6633FF, 0x6600FF, 0x9900FF, 0x9933FF, 0x9966FF, 0x9999FF, 0x99CCFF, 0x99FFFF,
0x00FFFF, 0x00CCFF, 0x0099FF, 0x0066FF, 0x0033FF, 0x0000FF, 0x3300FF, 0x3333FF, 0x3366FF, 0x3399FF, 0x33CCFF, 0x33FFFF,
0x00FFCC, 0x00CCCC, 0x0099CC, 0x0066CC, 0x0033CC, 0x0000CC, 0x3300CC, 0x3333CC, 0x3366CC, 0x3399CC, 0x33CCCC, 0x33FFCC,
0x00FF99, 0x00CC99, 0x009999, 0x006699, 0x003399, 0x000099, 0x330099, 0x333399, 0x336699, 0x339999, 0x33CC99, 0x33FF99,
0x00FF33, 0x00CC33, 0x009933, 0x006633, 0x003333, 0x000033, 0x330033, 0x333333, 0x336633, 0x339933, 0x33CC33, 0x33FF33,
0x00FF00, 0x00CC00, 0x009900, 0x006600, 0x003300, 0x000000, 0x330000, 0x333300, 0x336600, 0x339900, 0x33CC00, 0x33FF00,
<span style="color: #66cc66;">&#93;</span>;</pre></div></div>

<p><!-- --><br />
And then assign the <code>colors</code> array as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> myColorPicker:uiColorPicker = <span style="color: #000000; font-weight: bold;">new</span> uiColorPicker<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
myColorPicker.<span style="color: #006600;">colors</span> = COLORS_CONTINUOUS_TONE;</pre></div></div>

<p><a href="http://www.ghostwire.com/blog/wp-content/uploads/uicolorpicker_continuous_tone_palette.png"><img src="http://www.ghostwire.com/blog/wp-content/uploads/uicolorpicker_continuous_tone_palette.png" alt="" title="uicolorpicker_continuous_tone_palette" width="250" height="230" class="alignleft size-full wp-image-1785" /></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.</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/uicolorpicker-customizing-the-colors-palette/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uiColorPicker: Adding Drop Shadow To Popup Palette</title>
		<link>http://www.ghostwire.com/blog/archives/uicolorpicker-adding-drop-shadow-to-popup-palette/</link>
		<comments>http://www.ghostwire.com/blog/archives/uicolorpicker-adding-drop-shadow-to-popup-palette/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 08:00:11 +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[Flash Components]]></category>
		<category><![CDATA[Skinning]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1776</guid>
		<description><![CDATA[The uiColorPicker control displays a single rectangular button that brings up a palette of pre-defined set of colors (also known as a color swatch). By default, this popup does not cast a drop shadow, as shown in the screenshot below: In this post, we look at how to get the popup to cast a drop [...]]]></description>
			<content:encoded><![CDATA[<p>The uiColorPicker control displays a single rectangular button that brings up a palette of pre-defined set of colors (also known as a color swatch).  By default, this popup does not cast a drop shadow, as shown in the screenshot below:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/uicolopicker_example.png" alt="" title="uicolopicker_example" width="295" height="230" class="alignleft size-full wp-image-1767" /></p>
<p>In this post, we look at how to get the popup to cast a drop shadow, by simply adding some directives in the &#8220;rules.xml&#8221; of the theme you are using.</p>
<p><span id="more-1776"></span>The uiColorPicker component uses three skin assets:<br />
ColorPicker.png<br />
ColorPickerFrame.png<br />
ColorPickerInput.png</p>
<p>The ColorPicker.png is the image that will be used to render the rectangular button.  This skin asset is mandatory.  If it is missing, the component will not show.</p>
<p>The ColorPickerInput.png is optional, affecting the look of the text input field in the popup palette.  This skin is usually pointed to the same skin asset used by the uiTextInput component:</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;ColorPickerInput</span> <span style="color: #000066;">clone</span>=<span style="color: #ff0000;">&quot;TextInput&quot;</span> <span style="color: #000066;">prefs</span>=<span style="color: #ff0000;">&quot;width|74|focusPadding|1|padding|0&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>The ColorPickerFrame.png is the image that will be used to render the background of the popup palette.  You can specify styling directives for the popup, such as padding, in the &#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;ColorPickerFrame</span> <span style="color: #000066;">edge</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">prefs</span>=<span style="color: #ff0000;">&quot;padding|3&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Therefore, to get the popup to cast a drop shadow, all you need to do is to add the directive as such:</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;ColorPickerFrame</span> <span style="color: #000066;">edge</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">prefs</span>=<span style="color: #ff0000;">&quot;padding|3|background|shadow,0x000000&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>The result will be as shown below:<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/uicolorpicker_dropshadow.png" alt="" title="uicolorpicker_dropshadow" width="295" height="250" class="alignleft size-full wp-image-1778" /></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/uicolorpicker-adding-drop-shadow-to-popup-palette/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aspire UI Components Update v1.4</title>
		<link>http://www.ghostwire.com/blog/archives/aspire-ui-components-update-v1-4/</link>
		<comments>http://www.ghostwire.com/blog/archives/aspire-ui-components-update-v1-4/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 11:25:54 +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=1766</guid>
		<description><![CDATA[The Aspire UI Components toolkit has been updated to version 1.4 (changelog). With this update, the uiColorPicker component has been added to the Standard Edition. In addition, we have streamlined component instance alignment with the following: (i) new childAlignX and childAlignY properties help to define a default alignment for child objects contained within the same [...]]]></description>
			<content:encoded><![CDATA[<p>The Aspire UI Components toolkit has been updated to version 1.4 (<a href="/aspireui/docs/changelog">changelog</a>).</p>
<p><span id="more-1766"></span>With this update, the <a href="http://www.ghostwire.com/aspireui/docs/usage/uicolorpicker">uiColorPicker</a> component has been added to the Standard Edition.<br />
<img src="http://www.ghostwire.com/blog/wp-content/uploads/uicolopicker_example.png" alt="" title="uicolopicker_example" width="295" height="230" class="alignleft size-full wp-image-1767" /></p>
<p>In addition, we have streamlined component instance alignment with the following:</p>
<p>(i) new <code>childAlignX</code> and <code>childAlignY</code> properties help to define a default alignment for child objects contained within the same container.</p>
<p>(ii) a new qualified value for <code>alignX</code> and <code>alignY</code> properties &#8211; setting the property to <code>ALIGN.FILL</code> will indicate that the object is expected to fill its whole allocated space (horizontally for <code>alignX</code> or vertically for <code>alignY</code>), and therefore alignment does not apply.</p>
<p>(iii) as a result of (ii), it is no longer necessary to define <code>fillX</code> and <code>fillY</code> properties (since <code>ALIGN.FILL</code> and other alignment values should be mutually exclusive).</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-update-v1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
