<?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 &#187; TextField</title>
	<atom:link href="http://www.ghostwire.com/blog/archives/tag/textfield/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ghostwire.com/blog</link>
	<description>Flash UI Components</description>
	<lastBuildDate>Tue, 23 Aug 2011 03:51:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Severe TextField WordWrap Bug in Flash Player version 10.3.183.5</title>
		<link>http://www.ghostwire.com/blog/archives/severe-textfield-wordwrap-bug-in-flash-player-version-10-3-183-5/</link>
		<comments>http://www.ghostwire.com/blog/archives/severe-textfield-wordwrap-bug-in-flash-player-version-10-3-183-5/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 03:50:13 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Player Bug]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://www.ghostwire.com/blog/?p=1911</guid>
		<description><![CDATA[There is a severe TextField bug in current Flash Player version 10.3.183.5, causing text to display vertically with each letter on each line in TextField instances where the wordWrap property has been set to true. This causes a concern for the Flash Platform in general, because this shows that existing code is basically held hostage [...]]]></description>
			<content:encoded><![CDATA[<p>There is a severe TextField bug in current Flash Player version 10.3.183.5, causing text to display vertically with each letter on each line in TextField instances where the wordWrap property has been set to true.</p>
<p>This causes a concern for the Flash Platform in general, because this shows that existing code is basically held hostage to future Adobe Flash Player updates that may break past deployed code.  I would expect Adobe QA to be more rigorous than this.</p>
<p>This issue can be found in the bugbase, but while marked as fixed, it is not:</p>
<p><a href="https://bugbase.adobe.com/index.cfm?event=bug&#038;id=2941694">https://bugbase.adobe.com/index.cfm?event=bug&#038;id=2941694</a></p>
<p>Being an inherent player bug that causes problems to past deployed code, this is not something that can be fixed by using &#8220;workaround code&#8221;.</p>
<p>The problem is severe enough to warrant a quick update to version 10 (or pull 10.3.183.5 from further distribution), but Adobe has chosen to fix it only in version 11 BETA instead.  I don&#8217;t think this is acceptable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/severe-textfield-wordwrap-bug-in-flash-player-version-10-3-183-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[AS3] Drawing Outline on Text Glyphs</title>
		<link>http://www.ghostwire.com/blog/archives/as3-drawing-outline-on-text-glyphs/</link>
		<comments>http://www.ghostwire.com/blog/archives/as3-drawing-outline-on-text-glyphs/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 09:20:51 +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[Filters]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=429</guid>
		<description><![CDATA[Here is how you can draw an outline on text glyphs during run-time via ActionScript. This method works with embedded as well as non-embedded fonts. First, set up the TextField: // ActionScript 3.0 var txt:TextField = new TextField&#40;&#41;; // new TextFormat(font, size, color) txt.defaultTextFormat = new TextFormat&#40;&#34;DejaVu Sans&#34;, 21, 0xFFFFFF&#41;; txt.antiAliasType = AntiAliasType.ADVANCED; txt.autoSize = [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how you can draw an outline on text glyphs during run-time via ActionScript. This method works with embedded as well as non-embedded fonts.</p>
<p><span id="more-429"></span><br />
First, set up the TextField:</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> txt:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// new TextFormat(font, size, color)</span>
txt.<span style="color: #006600;">defaultTextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, <span style="color: #cc66cc;">21</span>, 0xFFFFFF<span style="color: #66cc66;">&#41;</span>;
txt.<span style="color: #006600;">antiAliasType</span> = AntiAliasType.<span style="color: #006600;">ADVANCED</span>;
txt.<span style="color: #0066CC;">autoSize</span> = TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;
txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
txt.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">5</span>;
txt.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">5</span>;
addChild<span style="color: #66cc66;">&#40;</span>txt<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><!-- --><br />
<strong>Drawing The Outline</strong><br />
To draw an outline around the text glyphs, use the <code>flash.filters.GlowFilter</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// new GlowFilter(color, alpha, blurX, blurY, strength)</span>
txt.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #000000; font-weight: bold;">new</span> GlowFilter<span style="color: #66cc66;">&#40;</span>0x000000, <span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;</pre></div></div>

<p><img src="http://ghostwire.com/blog/wp-content/uploads/outlinetext_4.png" alt="outline text weight 4" title="outline text weight 4" width="596" height="96" class="alignleft size-full wp-image-433" /></p>
<p><!-- --><br />
<strong>Adjusting The Outline Thickness</strong><br />
To thicken the outline, increase the values for &#8220;blurX&#8221;, &#8220;blurY&#8221; and &#8220;strength&#8221;.  The value of &#8220;blurX&#8221;/&#8221;blurY&#8221; should be the same.  You can try various values to suit your needs, but the value of &#8220;strength&#8221; should be kept at double that of &#8220;blurX&#8221;/&#8221;blurY&#8221;.  For example, if I were to use value of 4 for &#8220;blurX&#8221;/&#8221;blurY&#8221;, I would set &#8220;strength&#8221; as 8.  Setting &#8220;strength&#8221; too low will cause blurring to be visible; setting it excessively high and the outline may become distorted.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// new GlowFilter(color, alpha, blurX, blurY, strength)</span>
txt.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #000000; font-weight: bold;">new</span> GlowFilter<span style="color: #66cc66;">&#40;</span>0x000000, <span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">4</span>, <span style="color: #cc66cc;">4</span>, <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;</pre></div></div>

<p><img src="http://ghostwire.com/blog/wp-content/uploads/outlinetext_8.png" alt="outline text weight 8" title="outline text weight 8" width="596" height="96" class="alignleft size-full wp-image-432" /></p>
<p><!-- --><br />
<strong>Aspire UI</strong><br />
If you are using the <a href="http://www.ghostwire.com/aspireui/download/">Aspire UI library</a>, this feature is already built-in via the <code>uiTextStyles</code> manager:<br />
<a href="http://ghostwire.com/aspireui/docs/textstyles/outline-and-shadow">http://ghostwire.com/aspireui/docs/textstyles/outline-and-shadow</a><br />
The &#8220;outlineWeight&#8221; text style property (v1.2.2+) determines the thickness of the outline.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/as3-drawing-outline-on-text-glyphs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using uiTextStyles: Drawing Outline on Text Glyphs</title>
		<link>http://www.ghostwire.com/blog/archives/using-uitextstyles-drawing-outline-on-text-glyphs/</link>
		<comments>http://www.ghostwire.com/blog/archives/using-uitextstyles-drawing-outline-on-text-glyphs/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 13:42: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[Flash Components]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=528</guid>
		<description><![CDATA[Drawing outlines on text glyphs can help to give the text emphasis, or simply make it more legible or visible. This type of text rendering is commonly seen in video subtitles. When using the Aspire UI AS3 library, if you need to draw outlines on text glyphs in uiText instances, you can do so by [...]]]></description>
			<content:encoded><![CDATA[<p>Drawing outlines on text glyphs can help to give the text emphasis, or simply make it more legible or visible.  This type of text rendering is commonly seen in video subtitles.</p>
<p>When using the <a href="/aspireui/">Aspire UI AS3 library</a>, if you need to draw outlines on text glyphs in uiText instances, you can do so by defining the &#8220;outline&#8221; property when defining your text style(s).  This feature works with both embedded as well as non-embedded fonts.</p>
<p><span id="more-528"></span><br />
<strong>outline</strong><br />
Set up the text style via the uiTextStyles manager:</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>
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;demo&quot;</span>, <span style="color: #66cc66;">&#123;</span> fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontSize:<span style="color: #cc66cc;">21</span>, <span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span>, outline:<span style="color: #ff0000;">&quot;#000000&quot;</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Place the uiText instance:</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> txt:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
txt.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;demo&quot;</span>; <span style="color: #808080; font-style: italic;">// assign &quot;demo&quot; text style</span>
txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
txt.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>txt<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><img src="http://ghostwire.com/blog/wp-content/uploads/outlinetext_4.png" alt="outline text weight 4" title="outline text weight 4" width="596" height="96" class="alignleft size-full wp-image-433" /></p>
<p><!-- --><br />
<strong>outlineWeight</strong><br />
To adjust the thickness of the outline, you can specify the &#8220;outlineWeight&#8221; property (v1.2.2+). The default value for &#8220;outlineWeight&#8221; is 4. Specify a larger number for a thicker outline.</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>
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;demo&quot;</span>, <span style="color: #66cc66;">&#123;</span> fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontSize:<span style="color: #cc66cc;">21</span>, <span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span>, outline:<span style="color: #ff0000;">&quot;#000000&quot;</span>, outlineWeight:<span style="color: #cc66cc;">8</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><img src="http://ghostwire.com/blog/wp-content/uploads/outlinetext_8.png" alt="outline text weight 8" title="outline text weight 8" width="596" height="96" class="alignleft size-full wp-image-432" /></p>
<p>Try different values and see what works for the kind of look you want to achieve. Use values proportional to the font size. Obviously, if you are using a small font size, don&#8217;t specify a huge number for &#8220;outlineWeight&#8221;. One important thing to take note of is that this outline will not be taken into account when computing the uiText instance&#8217;s preferred size and a thick outline may therefore fall outside the bounds of its allocated space (can be rectified by giving the instance some <a href="http://ghostwire.com/aspireui/docs/layout/margin-and-padding">&#8220;margin&#8221;</a>).</p>
<p><!-- --><br />
<strong>CSS</strong><br />
Instead of hard-coding text styles via ActionScript, you may also define the style in CSS (text.css in the theme folder):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">demo
<span style="color: #00AA00;">&#123;</span>
	fontFamily<span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span><span style="color: #00AA00;">;</span>
	fontSize<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">21</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;#FFFFFF&quot;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;#000000&quot;</span><span style="color: #00AA00;">;</span>
	outlineWeight<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">8</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#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 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="/aspireui/download/">downloading a trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/using-uitextstyles-drawing-outline-on-text-glyphs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unicode Character Charts By Script</title>
		<link>http://www.ghostwire.com/blog/archives/unicode-character-charts-by-script/</link>
		<comments>http://www.ghostwire.com/blog/archives/unicode-character-charts-by-script/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 08:09:29 +0000</pubDate>
		<dc:creator>sunny</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Embedded Fonts]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=530</guid>
		<description><![CDATA[If you often embed fonts for use in Flash/Flex and needs to specify &#8220;unicodeRange&#8221; in the [Embed] meta tag, the following site gives you the unicode tables for the various character glyphs: http://unicode.org/charts/ For example, if you need to embed Thai characters, you can look up &#8220;Thai&#8221; under &#8220;South East Asian&#8221; on that website &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>If you often embed fonts for use in Flash/Flex and needs to specify &#8220;unicodeRange&#8221; in the [Embed] meta tag, the following site gives you the unicode tables for the various character glyphs:</p>
<p><span id="more-530"></span><a href="http://unicode.org/charts/">http://unicode.org/charts/</a></p>
<p>For example, if you need to embed Thai characters, you can look up &#8220;Thai&#8221; under &#8220;South East Asian&#8221; on that website &#8211; it will give you a PDF document, have a peek inside and you will see that Thai characters are in the range &#8220;U+0E00-U+0E7F&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,
unicodeRange=<span style="color: #ff0000;">&quot;U+0E00-U+0E7F&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const REGULAR:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

<p><strong>Note</strong><br />
The font you are embedding must of course contain the respective glyphs in the specified unicode range(s).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/unicode-character-charts-by-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[AS3] Embossed and Engraved Text Effects (Embedded Fonts)</title>
		<link>http://www.ghostwire.com/blog/archives/as3-embossed-and-engraved-text-effects-embedded-fonts/</link>
		<comments>http://www.ghostwire.com/blog/archives/as3-embossed-and-engraved-text-effects-embedded-fonts/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 06:45:02 +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[Embedded Fonts]]></category>
		<category><![CDATA[Filters]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=368</guid>
		<description><![CDATA[Here is how to apply embossed (and engraved) text effect during run-time easily using ActionScript. This works only when the TextField instance is using embedded font and its antiAliasType property is set to AntiAliasType.ADVANCED. Set up the TextField: // ActionScript 3.0 var txt:TextField = new TextField&#40;&#41;; // new TextFormat(font, size, color, bold) txt.defaultTextFormat = new [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how to apply embossed (and engraved) text effect during run-time easily using ActionScript.  This works only when the TextField instance is using embedded font and its antiAliasType property is set to AntiAliasType.ADVANCED.</p>
<p><span id="more-368"></span><br />
Set up the TextField:</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> txt:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// new TextFormat(font, size, color, bold)</span>
txt.<span style="color: #006600;">defaultTextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, <span style="color: #cc66cc;">21</span>, 0x000000, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
txt.<span style="color: #0066CC;">embedFonts</span> = <span style="color: #000000; font-weight: bold;">true</span>; <span style="color: #808080; font-style: italic;">// the font must be embedded</span>
txt.<span style="color: #006600;">antiAliasType</span> = AntiAliasType.<span style="color: #006600;">ADVANCED</span>;
txt.<span style="color: #0066CC;">autoSize</span> = TextFieldAutoSize.<span style="color: #0066CC;">LEFT</span>;
txt.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;
txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
txt.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">5</span>;
txt.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">5</span>;
addChild<span style="color: #66cc66;">&#40;</span>txt<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><strong>Embossed Text</strong><br />
To apply an embossed text effect, use the flash.filters.BevelFilter:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">txt.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.5</span>, <span style="color: #cc66cc;">45</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// distance, angle</span></pre></div></div>

<p><img src="http://ghostwire.com/blog/wp-content/uploads/embossedtext1.png" alt="embossed text" title="embossed text" width="596" height="96" class="alignnone size-full wp-image-389" /></p>
<p><strong>Engraved Text</strong><br />
To apply an engraved text effect, ie having the text look like it is etched into the surface, rotate the bevel angle by 180 degrees:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">txt.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.5</span>, <span style="color: #cc66cc;">225</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// distance, angle</span></pre></div></div>

<p><img src="http://ghostwire.com/blog/wp-content/uploads/engravedtext1.png" alt="engraved text" title="engraved text" width="596" height="96" class="alignnone size-full wp-image-390" /></p>
<p>The first parameter of the BevelFilter is the bevel distance &#8211; you can try various values, but I have found 1.5 to work well for most font sizes, to give the text a subtle yet visible embossed/engraved look.</p>
<p>Do bear in mind that in order for the effects to be visible, there must be reasonable amount of painted area on the text glyphs. If you use a small, thin font, then the effects are not going to be very visible. On the other hand, using a large, bold font is going make the effect more obvious.</p>
<p>If you are going to use the same filter(s) in multiple places, consider placing the filter(s) in a constant:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> const embossFilter:BevelFilter = <span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.5</span>, <span style="color: #cc66cc;">45</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">private</span> const engraveFilter:BevelFilter = <span style="color: #000000; font-weight: bold;">new</span> BevelFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.5</span>, <span style="color: #cc66cc;">225</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>You can then apply the filter as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">txt.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span>embossFilter<span style="color: #66cc66;">&#93;</span>;</pre></div></div>

<p>NOTE:<br />
Notice that in the example above, the &#8220;selectable&#8221; property of the TextField instance is set to &#8220;false&#8221;.  This is not really necessary, but it is important to note if the property is left as &#8220;true&#8221;, ie the text if left selectable, then when the text is selected, the portion that is selected loses the embossed/engraved effect.  This is because the BevelFilter is applied to the TextField as a whole, not each alphabet individually &#8211; when there is a selection, and the background is highlighted (painted), the filter is applied to the background rather than the text in the foreground.<br />
<img src="http://ghostwire.com/blog/wp-content/uploads/embossedtexts.png" alt="embossed text selected" title="embossed text selected" width="596" height="96" class="alignnone size-full wp-image-388" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/as3-embossed-and-engraved-text-effects-embedded-fonts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using uiTextStyles: Defining Faux Bold Weights (Embedded Fonts)</title>
		<link>http://www.ghostwire.com/blog/archives/using-uitextstyles-defining-faux-bold-weights-embedded-fonts/</link>
		<comments>http://www.ghostwire.com/blog/archives/using-uitextstyles-defining-faux-bold-weights-embedded-fonts/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 06:30:54 +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[Embedded Fonts]]></category>
		<category><![CDATA[Flash Components]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=356</guid>
		<description><![CDATA[Yesterday, the Aspire UI library was updated to version 1.2.0. Among other changes, we have also implemented support for faux bold weights for embedded fonts. Faux bold is &#8220;fake&#8221; bold. It is an efficient way to display text in the same typeface but with different weights (bolder, thinner, etc.). It can be used as an [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, the <a href="/aspireui/">Aspire UI</a> library was updated to version 1.2.0.  Among other <a href="/aspireui/docs/changelog">changes</a>, we have also implemented support for faux bold weights for embedded fonts.</p>
<p>Faux bold is &#8220;fake&#8221; bold.  It is an efficient way to display text in the same typeface but with different weights (bolder, thinner, etc.).  It can be used as an alternative to the real bold font, or used in combination with the real thing.</p>
<p>Sometimes, the bold version of a font simply doesn&#8217;t exist so this is also where faux boldness comes in. Or, you can use this feature to make the typeface thinner (rather than bolder).</p>
<p><span id="more-356"></span><br />
<strong>The &#8220;weight&#8221; Property</strong><br />
The “weight” property is defined in CSS just like the other text formatting properties:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">specialstyle
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>
	weight<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">200</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>If you prefer to define the style within your application code using ActionScript:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">	uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;specialstyle&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span>,weight:<span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The value of the &#8221;weight&#8221; property should be a value between -200 to 200. To make the font thinner, use a negative number. To make the font bolder, use a positive number.</p>
<p>You can also use some predefined values when specifying the &#8221;weight&#8221; property:<br />
&#8220;bolder&#8221; is equivalent to 200<br />
&#8220;bold&#8221; is equivalent to 100<br />
&#8220;thin&#8221; is equivalent to -100<br />
&#8220;thinner&#8221; is equivalent to -200</p>
<p><!-- --><br />
<strong>Example</strong><br />
<img src="/blog/wp-content/uploads/uitextfauxbold.png" alt="uiTextStyles Faux Bold" title="uitextfauxbold" width="516" height="296" class="size-full wp-image-357" /></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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;">uiText</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;">uiFonts</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;">uiTextStyles</span>;
&nbsp;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleA&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,weight:<span style="color: #ff0000;">&quot;thinner&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// -200</span>
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleB&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,weight:<span style="color: #ff0000;">&quot;thin&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// -100</span>
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleC&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleD&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,weight:<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// 100</span>
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleE&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,weight:<span style="color: #ff0000;">&quot;bolder&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// 200</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// ** faux bold weights can also be combined with true bold **</span>
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleAb&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span>,weight:<span style="color: #ff0000;">&quot;thinner&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleBb&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span>,weight:<span style="color: #ff0000;">&quot;thin&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleCb&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleDb&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span>,weight:<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;styleEb&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontFamily:<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,fontSize:<span style="color: #cc66cc;">16</span>,fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span>,weight:<span style="color: #ff0000;">&quot;bolder&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
uiFonts.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextA:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextA.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextA.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextA.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleA&quot;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextA<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextB:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextB.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextB.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextB.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleB&quot;</span>;
displayTextB.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextB<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextC:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextC.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextC.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextC.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleC&quot;</span>;
displayTextC.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextC<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextD:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextD.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextD.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextD.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleD&quot;</span>;
displayTextD.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">60</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextD<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextE:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextE.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextE.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextE.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleE&quot;</span>;
displayTextE.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">80</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextE<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextAb:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextAb.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextAb.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextAb.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleAb&quot;</span>;
displayTextAb.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">105</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextAb<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextBb:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextBb.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextBb.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextBb.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleBb&quot;</span>;
displayTextBb.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">125</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextBb<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextCb:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextCb.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextCb.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextCb.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleCb&quot;</span>;
displayTextCb.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">145</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextCb<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextDb:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextDb.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextDb.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextDb.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleDb&quot;</span>;
displayTextDb.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">165</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextDb<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> displayTextEb:uiText	= <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
displayTextEb.<span style="color: #006600;">rotation</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">// ** text will not show unless using embedded fonts **</span>
displayTextEb.<span style="color: #0066CC;">text</span>	= <span style="color: #ff0000;">&quot;The quick brown fox jumps over the lazy dog.&quot;</span>;
displayTextEb.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;styleEb&quot;</span>;
displayTextEb.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">185</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>displayTextEb<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><!-- --><br />
<strong>Note</strong><br />
The faux bold feature is implemented via the &#8220;thickness&#8221; property of the native flash.text.TextField class. Therefore, if you are not using the Aspire UI library, you can still implement the same faux bold feature via that property &#8211; just make sure that you have embedded the font and the &#8220;antiAliasType&#8221; property of the text field is set to flash.text.AntiAliasType.ADVANCED.</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="/aspireui/download/">downloading a trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/using-uitextstyles-defining-faux-bold-weights-embedded-fonts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using uiTextInput: Displaying a &#8220;hint&#8221; text in the absense of any input</title>
		<link>http://www.ghostwire.com/blog/archives/using-uitextinput-displaying-a-hint-text-in-the-absense-of-any-input/</link>
		<comments>http://www.ghostwire.com/blog/archives/using-uitextinput-displaying-a-hint-text-in-the-absense-of-any-input/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 07:13:51 +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[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=275</guid>
		<description><![CDATA[Sometimes, it is useful to give an empty text input field a textual background. It serves as a &#8220;hint&#8221; to end-users as to what input is expected from them, or it can also be used in-lieu of input field labels. A &#8220;hint&#8221; text is different from a default text value. The &#8220;hint&#8221; text is displayed [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, it is useful to give an empty text input field a textual background. It serves as a &#8220;hint&#8221; to end-users as to what input is expected from them, or it can also be used in-lieu of input field labels.</p>
<p>A &#8220;hint&#8221; text is different from a default text value. The &#8220;hint&#8221; text is displayed only if the text field is empty; it is not displayed while the field has focus or if the field is already populated with any value. The &#8220;hint&#8221; text is also not reported as the value of the text field.</p>
<p><span id="more-275"></span><br />
<strong>uiTextInput &#8220;hint&#8221; property</strong><br />
Using the <a href="/aspireui/docs/usage/uitextinput">uiTextInput</a> component from the <a href="/aspireui/">Aspire UI</a> library, implementing a &#8220;hint&#8221; text is easy &#8211; just specify the &#8220;hint&#8221; property:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> input:uiTextInput = <span style="color: #000000; font-weight: bold;">new</span> uiTextInput<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
input.<span style="color: #006600;">hint</span> = <span style="color: #ff0000;">&quot;some hint&quot;</span>;</pre></div></div>

<p><!-- --><br />
<strong>Example</strong><br />
Here is an example SWF:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_HintTextDemo_688116559"
			class="flashmovie"
			width="200"
			height="100">
	<param name="movie" value="/aspireui/swf/HintTextDemo.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/aspireui/swf/HintTextDemo.swf"
			name="fm_HintTextDemo_688116559"
			width="200"
			height="100">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The text style used when a hint is displayed can be (and should be) different from that used by the uiTextInput instance normally. The hint text uses a &#8220;_hint&#8221; sub-style of the style used by the uiTextInput instance, and can be specified either via the &#8220;text.css&#8221; CSS file in the theme folder or via actionscripting using the uiTextStyles manager. In the above example, we used the uiTextStyles manager.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;searchStyle&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#000000&quot;</span>,fontSize:<span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;searchStyle_hint&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#777777&quot;</span>,fontStyle:<span style="color: #ff0000;">&quot;italic&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The rest of the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</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: #66cc66;">*</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: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #0066CC;">data</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">ghostwire</span>.<span style="color: #006600;">ui</span>.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</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: #66cc66;">*</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: #66cc66;">*</span>;
&nbsp;
	<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: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">system</span>.<span style="color: #0066CC;">Capabilities</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HintTextDemo <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> HintTextDemo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// ** make sure stage is not null **</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>
&nbsp;
		<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: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// ** let assets preload before starting application **</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>
&nbsp;
		<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;">// ** main application code **</span>
&nbsp;
			uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;searchStyle&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#000000&quot;</span>,fontSize:<span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
			uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;searchStyle_hint&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#777777&quot;</span>,fontStyle:<span style="color: #ff0000;">&quot;italic&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> searchEntry:uiTextInput = <span style="color: #000000; font-weight: bold;">new</span> uiTextInput<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			searchEntry.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;searchStyle&quot;</span>;
			searchEntry.<span style="color: #006600;">hint</span> = <span style="color: #ff0000;">&quot;Search&quot;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> searchBtn:uiPushButton = <span style="color: #000000; font-weight: bold;">new</span> uiPushButton<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #ff0000;">&quot;search.png&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> searchBox:uiBox	= <span style="color: #000000; font-weight: bold;">new</span> uiBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			searchBox.<span style="color: #006600;">spacing</span>		= <span style="color: #cc66cc;">5</span>;
			searchBox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>searchEntry<span style="color: #66cc66;">&#41;</span>;
			searchBox.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>searchBtn<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> searchForm:uiForm = <span style="color: #000000; font-weight: bold;">new</span> uiForm<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			searchForm.<span style="color: #006600;">defaultButton</span> = searchBtn;
			searchForm.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span>,<span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>;
			searchForm.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>searchBox<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			addChild<span style="color: #66cc66;">&#40;</span>searchForm<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></td></tr></table></div>

<p><em>Note: The &#8220;hint&#8221; property is available to the uiTextInput class only in version 1.1.2+.</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 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="/aspireui/download/">downloading a trial version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/using-uitextinput-displaying-a-hint-text-in-the-absense-of-any-input/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling embedded font SWFs with the Flex compiler for use with the uiFonts manager</title>
		<link>http://www.ghostwire.com/blog/archives/compiling-embedded-font-swfs-with-the-flex-compiler-for-use-with-the-uifonts-manager/</link>
		<comments>http://www.ghostwire.com/blog/archives/compiling-embedded-font-swfs-with-the-flex-compiler-for-use-with-the-uifonts-manager/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 08:58:58 +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[Embedded Fonts]]></category>
		<category><![CDATA[Flash Components]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=173</guid>
		<description><![CDATA[In a previous demo Loading embedded fonts on-demand using the uiFonts manager, the uiFonts manager was shown to load external embedded font SWFs &#8220;on-demand&#8221;. The uiFonts manager can work with embedded font SWFs compiled either from the Flash IDE or the Flex compiler. When compiling using the Flash IDE, we use Font Symbols in the [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous demo <a href="/blog/archives/loading-embedded-fonts-on-demand-using-the-uifonts-manager/">Loading embedded fonts on-demand using the uiFonts manager</a>, the uiFonts manager was shown to load external embedded font SWFs &#8220;on-demand&#8221;.</p>
<p>The uiFonts manager can work with embedded font SWFs compiled either from the Flash IDE or the Flex compiler.</p>
<p>When compiling using the Flash IDE, we use Font Symbols in the Library (see <a href="/aspireui/docs/usage/uifonts">uiFonts usage notes</a>).</p>
<p>When compiling using the Flex compiler, we use a single AS3 class file. The following shows how the AS3 Class must be written in order for the resulting SWF to work with the uiFonts manager.</p>
<p><span id="more-173"></span></p>
<p><em>If you are using <a href="http://www.flashdevelop.org">Flash Develop</a>, the following method for building font SWFs apply as well and you may use Tools -&gt; Flash Tools -&gt; Build Current File (CTRL-F8) to compile the class.</em></p>
<p>In this example, we will create a &#8220;DejaVu_Sans.swf&#8221; file containing the &#8220;DejaVu Sans&#8221; font. The font is available from <a href="http://dejavu-fonts.org">http://dejavu-fonts.org</a>.</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>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DejaVu_Sans <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,
		unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const REGULAR:<span style="color: #000000; font-weight: bold;">Class</span>;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span>,
		unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">BOLD</span>:<span style="color: #000000; font-weight: bold;">Class</span>;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span>,
		unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">ITALIC</span>:<span style="color: #000000; font-weight: bold;">Class</span>;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span>, fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span>,
		unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const BOLD_ITALIC:<span style="color: #000000; font-weight: bold;">Class</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><strong>Class Name</strong></p>
<ul>
<li>First of all, the class name must match the name of the font, converting any space to underscore.</li>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DejaVu_Sans <span style="color: #0066CC;">extends</span> Sprite</pre></div></div>

</ul>
<p><strong>REGULAR</strong></p>
<ul>
<li>Embedding the REGULAR version of the font is mandatory. You may skip the BOLD, ITALIC and BOLD_ITALIC versions, but not the REGULAR version.</li>
<li>The REGULAR version of the font is embedded by defining a static variable (or constant) named REGULAR and declaring the [Embed] meta tag above it accordingly:</li>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>,
unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const REGULAR:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

</ul>
<p><strong>BOLD</strong></p>
<ul>
<li>If the font has a BOLD version (depends on the font developer &#8211; not all fonts are provided with a bold version), you may embed that version by defining a static variable (or constant) with the name BOLD and declaring the &#8220;fontWeight&#8221; value as &#8220;bold&#8221; in the meta tag:</li>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span>,
unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">BOLD</span>:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

</ul>
<p><strong>ITALIC</strong></p>
<ul>
<li>Likewise, if the font has an ITALIC version (most CJK fonts do not have italic versions), you may embed that version by defining a static variable (or constant) with the name ITALIC and declaring the &#8220;fontStyle&#8221; value as &#8220;italic&#8221;:</li>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span>,
unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">ITALIC</span>:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

</ul>
<p><strong>BOLD_ITALIC</strong></p>
<ul>
<li>If the font has both BOLD and ITALIC versions, you may embed a BOLD_ITALIC version:</li>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>mimeType=<span style="color: #ff0000;">&quot;application/x-font&quot;</span>, systemFont=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontName=<span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span>, fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span>, fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span>,
unicodeRange=<span style="color: #ff0000;">&quot;U+0020-U+007E&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const BOLD_ITALIC:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

</ul>
<p><strong>unicodeRange</strong></p>
<ul>
<li>The &#8220;unicodeRange&#8221; value in the [Embed] meta tag determines which glyphs to include. In the above example, we have embedded glyphs from the basic latin range:
<p>// BASIC LATIN<br />
U+0020-U+002F // punctuation<br />
U+0030-U+0039 // 0-9<br />
U+003A-U+0040 // punctuation<br />
U+0041-U+005A // A-Z<br />
U+005B-U+0060 // punctuation<br />
U+0061-U+007A // a-z<br />
U+007B-U+007E // punctuation
</li>
<li>If you happen to need Japanese glyphs, the following range would be useful:
<p>// JAPANESE KANA<br />
// Japanese-style punctuation<br />
U+3000-U+303F<br />
// Hiragana<br />
U+3040-U+309F<br />
// Katakana<br />
U+30A0-U+30FF<br />
// Half-width katakana<br />
U+FF61-U+FF9F<br />
// Full-width roman characters (suggest omit)<br />
U+FF00-U+FF60<br />
// CJK unifed ideographs &#8211; Common and uncommon kanji (huge!)<br />
U+4E00-U+9FAF
</li>
<li>The font you are embedding must of course contain the respective glyphs in the specified unicode range(s).</li>
</ul>
<p><strong>Using with the uiFonts manager</strong></p>
<ul>
<li>Once you have compiled the font SWF, put it in the project&#8217;s &#8220;assets/fonts/&#8221; folder to make it available for use in your application.
</li>
<li>Calling the uiFonts.manager.load() method will load &#8220;DejaVu_Sans.swf&#8221; from the fonts folder (note: specify the <em>font</em> name when calling the load() method, not the <em>file</em> name).

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">uiFonts.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;DejaVu Sans&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

</li>
<li>As shown in the previous <a href="/blog/archives/loading-embedded-fonts-on-demand-using-the-uifonts-manager/">demo</a>, the uiFonts manager will work hand-in-hand with the uiTextStyles manager to automatically apply embedded fonts to uiText instances on the stage (instances that are using the respective font(s)) after loading completes.
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/compiling-embedded-font-swfs-with-the-flex-compiler-for-use-with-the-uifonts-manager/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>[AS3] Fixing TextField.bottomScrollV and TextField.maxScrollV</title>
		<link>http://www.ghostwire.com/blog/archives/fixing-textfieldbottomscrollv-and-textfieldmaxscrollv/</link>
		<comments>http://www.ghostwire.com/blog/archives/fixing-textfieldbottomscrollv-and-textfieldmaxscrollv/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 17:50:17 +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[Flash Player Bug]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=11</guid>
		<description><![CDATA[There is a rather strange issue with the flash.text.TextField class, one related to the delayed updating of the TextField.bottomScrollV and TextField.maxScrollV properties. The TextField.bottomScrollV indicates the bottommost line that is currently visible in the specified text field while the TextField.maxScrollV indicates the maximum vertical scroll position value. The problem with these two properties is that [...]]]></description>
			<content:encoded><![CDATA[<p>There is a rather strange issue with the flash.text.TextField class, one related to the <em>delayed</em> updating of the TextField.bottomScrollV and TextField.maxScrollV properties. The TextField.bottomScrollV indicates the bottommost line that is currently visible in the specified text field while the TextField.maxScrollV indicates the maximum vertical scroll position value.</p>
<p>The problem with these two properties is that they do not update immediately at those times when they should -</p>
<p>(i) when a TextField instance is resized such that the vertical scroll bounds change; and</p>
<p>(ii) when the TextField.wordWrap property changes (from false to true or vice versa).</p>
<p><span id="more-11"></span><br />
Some simple code to replicate and demonstrate this issue:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
txt.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">100</span>;
txt.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">100</span>;
txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;Line 1<span style="color: #000099; font-weight: bold;">\n</span>Line 2<span style="color: #000099; font-weight: bold;">\n</span>Line 3<span style="color: #000099; font-weight: bold;">\n</span>Line 4<span style="color: #000099; font-weight: bold;">\n</span>Line 5<span style="color: #000099; font-weight: bold;">\n</span>Line 6<span style="color: #000099; font-weight: bold;">\n</span>Line 7<span style="color: #000099; font-weight: bold;">\n</span>Line 8<span style="color: #000099; font-weight: bold;">\n</span>Line 9<span style="color: #000099; font-weight: bold;">\n</span>Line 10&quot;</span>;
addChild<span style="color: #66cc66;">&#40;</span>txt<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;bottomScrollV is:&quot;</span>+txt.<span style="color: #006600;">bottomScrollV</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// output 6, correct value</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;maxScrollV is:&quot;</span>+txt.<span style="color: #006600;">maxScrollV</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// output 5, correct value</span>
&nbsp;
<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,on_click<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> on_click<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>
	txt.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">50</span>; <span style="color: #808080; font-style: italic;">// ** shrink the height **</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;bottomScrollV is:&quot;</span>+txt.<span style="color: #006600;">bottomScrollV</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// output 6, WRONG!</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;maxScrollV is:&quot;</span>+txt.<span style="color: #006600;">maxScrollV</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// output 5, WRONG!</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>In the code above, when you click on the stage, the text field is shrunk to 50px height resulting in only 3 lines showing, which means that the bottomScrollV value should have been 3 and the maxScrollV 8, but the values will remain at 6 and 5 respectively&#8230; until&#8230; supposedly&#8230; one frame interval later. Yes, that is what I mean by the <em>delayed</em> updating issue. The same issue applies if you toggle the TextField.wordWrap property.</p>
<p>Apparently, this issue still exists in Flash Player 10.</p>
<p>Admittedly the issue is minor. Perhaps most ActionScripters will never be bothered by it. This <em>is</em> a problem however if you are trying to build accurate text scrollers. I suppose you could work around by living with the &#8220;timing&#8221; issue and fix it with a &#8220;timing&#8221; hack, ie checking the properties only next frame interval.</p>
<p><strong>But here is a fix for the issue</strong> &#8211; just call the TextField.getCharBoundaries() method after the TextField instance is resized (or the wordWrap property has changed). In the example above, we would write the code as:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> on_click<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>
	txt.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">50</span>; <span style="color: #808080; font-style: italic;">// ** shrink the height **</span>
	txt.<span style="color: #006600;">getCharBoundaries</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;bottomScrollV is:&quot;</span>+txt.<span style="color: #006600;">bottomScrollV</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// output 3, CORRECT!</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;maxScrollV is:&quot;</span>+txt.<span style="color: #006600;">maxScrollV</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// output 8, CORRECT!</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Don&#8217;t ask me how or why it works. It just does. My guess is perhaps when trying to resolve the character boundaries the TextField instance is forced to re-compute its bounding box and update its scroll properties&#8230; It was this guesswork that got me trying anyway, so that would be my explanation if I need to give one.</p>
<p>Once again, simple fix:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">	txt.<span style="color: #006600;">getCharBoundaries</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>NOTE:<br />
The getCharBoundaries() method accepts one parameter &#8211; the index of the character to query &#8211; and returns a rectangle that is the bounding box of that specified character. In the above case, however, we use the method only as a fix for the TextField.bottomScrollV and TextField.maxScrollV issue &#8211; we just feed any index for the parameter and we are not interested in the rectangle returned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/fixing-textfieldbottomscrollv-and-textfieldmaxscrollv/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Aspire UI Preview: Text Styles</title>
		<link>http://www.ghostwire.com/blog/archives/aspire-ui-preview-text-styles/</link>
		<comments>http://www.ghostwire.com/blog/archives/aspire-ui-preview-text-styles/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 17:28:14 +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[TextField]]></category>

		<guid isPermaLink="false">http://ghostwire.com/blog/?p=6</guid>
		<description><![CDATA[In Aspire, text styles are managed via an external CSS file which is loaded and parsed automatically by the framework. This CSS file is by default &#8220;text.css&#8221; in the theme folder (so you can easily define different text styles that are appropriate for different themes). Multi-State Styles Let&#8217;s take a look at a snippet of [...]]]></description>
			<content:encoded><![CDATA[<p>In <a title="Aspire UI Components" href="http://ghostwire.com/aspireui/">Aspire</a>, text styles are managed via an external CSS file which is loaded and parsed automatically by the framework. This CSS file is by default &#8220;text.css&#8221; in the theme folder (so you can easily define different text styles that are appropriate for different themes).<br />
<span id="more-6"></span></p>
<p><strong>Multi-State Styles</strong><br />
Let&#8217;s take a look at a snippet of an example CSS file:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">button
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
button_disabled
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#808080</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
button_over
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#cc0000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
button_selected
<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The above demonstrates how to define text styles for different visual states. For example, a uiLabelButton instance whose &#8220;textStyle&#8221; property has been set to &#8220;button&#8221; will render its text in black (#000000) normally, red (#cc0000) when mouse over, white (#ffffff) when selected, and gray (#808080) when disabled.</p>
<p><strong>Embedded Styles</strong><br />
While it is recommended that you keep all the text styles defined in the external CSS file for easy modifications, you can also define additional styles in your application code. For example, take a look at the following:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><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;">uiBox</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;">uiText</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;">uiTextStyles</span>;
&nbsp;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;style1&quot;</span>,<span style="color: #66cc66;">&#123;</span>shadow:<span style="color: #ff0000;">&quot;#808080&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;style2&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#ffffff&quot;</span>,outline:<span style="color: #ff0000;">&quot;#000000&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;style3&quot;</span>,<span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#ffffff&quot;</span>,outline:<span style="color: #ff0000;">&quot;#000000&quot;</span>,shadow:<span style="color: #ff0000;">&quot;#808080&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;style4&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;style5&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontStyle:<span style="color: #ff0000;">&quot;italic&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
uiTextStyles.<span style="color: #006600;">manager</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;style6&quot;</span>,<span style="color: #66cc66;">&#123;</span>fontStyle:<span style="color: #ff0000;">&quot;italic&quot;</span>,fontWeight:<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this is normal text&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt_shadowed:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this text has gray shadow&quot;</span><span style="color: #66cc66;">&#41;</span>;
txt_shadowed.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;style1&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt_outline:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this is white text with black outline&quot;</span><span style="color: #66cc66;">&#41;</span>;
txt_outline.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;style2&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt_outshadowed:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this is white text with black outline and gray shadow&quot;</span><span style="color: #66cc66;">&#41;</span>;
txt_outshadowed.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;style3&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt_bold:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this is bold text&quot;</span><span style="color: #66cc66;">&#41;</span>;
txt_bold.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;style4&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt_italic:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this is italic text&quot;</span><span style="color: #66cc66;">&#41;</span>;
txt_italic.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;style5&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> txt_bolditalic:uiText = <span style="color: #000000; font-weight: bold;">new</span> uiText<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;this is bold italic text&quot;</span><span style="color: #66cc66;">&#41;</span>;
txt_bolditalic.<span style="color: #006600;">textStyle</span> = <span style="color: #ff0000;">&quot;style6&quot;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> box:uiBox = <span style="color: #000000; font-weight: bold;">new</span> uiBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">vertical</span> = <span style="color: #000000; font-weight: bold;">true</span>;
addChild<span style="color: #66cc66;">&#40;</span>box<span style="color: #66cc66;">&#41;</span>
&nbsp;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt<span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt_shadowed<span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt_outline<span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt_outshadowed<span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt_bold<span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt_italic<span style="color: #66cc66;">&#41;</span>;
box.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>txt_bolditalic<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The above will generate the following:<br />
<img src="http://ghostwire.com/images/v3/aspireui_uitextstyles.png" alt="uiTextStyles screenshot" width="303" height="174" /><br />
(above is a screenshot of the compiled SWF)</p>
<p><strong>&#8220;outline&#8221; and &#8220;shadow&#8221; Properties</strong><br />
As shown above, not only is it easy to define various text styles, you can also define “outline” and “shadow” properties (not otherwise available in vanilla Actionscript). The “outline” property when defined will cause the an outline to be drawn on the text glyphs. This is commonly seen in video subtitles. The “shadow” property when defined will cause the text cast a subtle shadow, resulting in either a raised or lowered look depending on the color combinations.</p>
<p><strong>Containers and Style Inheritance</strong><br />
Note that all uiComponent instances have a &#8220;textStyle&#8221; property &#8211; you do not need to set the &#8220;textStyle&#8221; property of each individual uiText instance directly because they will inherit the property value from their containing (grand)parents if their own &#8220;textStyle&#8221; property is undefined. Therefore, you can set the &#8220;textStyle&#8221; property of a container and all the uiText instances within the container whose &#8220;textStyle&#8221; property is undefined will inherit that same value defined for that container.</p>
<p><strong>Aspire UI Components Trial Version<br />
</strong>You may experiment with the various features of the Actionscript 3.0 (AS3) <a title="Aspire UI Components" href="http://ghostwire.com/aspireui/">Aspire UI Components</a> by downloading the trial version at <a title="Download Aspire UI Set 1 Trial Version" href="http://ghostwire.com/aspireui/download/">http://ghostwire.com/aspireui/download/</a><br />
* Adobe Flash CS3 is required</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ghostwire.com/blog/archives/aspire-ui-preview-text-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

