<?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>The Morphic Group &#187; as3</title>
	<atom:link href="http://www.themorphicgroup.com/blog/tag/as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.themorphicgroup.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 22 Feb 2010 18:20:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Embeding Fonts for use in TextFormat and CSS</title>
		<link>http://www.themorphicgroup.com/blog/2009/03/20/embeding-fonts-for-use-in-textformat-and-css/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/03/20/embeding-fonts-for-use-in-textformat-and-css/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 19:07:17 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[FlexBuiler]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[registerFont]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[TextFormat]]></category>
		<category><![CDATA[ttf]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=76</guid>
		<description><![CDATA[I regularly have problems embedding fonts in my SWF files. There are a variety of different ways to embed fonts; many of which are detailed in the documentation. I am going to show my preferred way to embed fonts that solve many of the problems are arise when embedding fonts in other ways. One of the biggest issues that I [...]]]></description>
			<content:encoded><![CDATA[<p><span>I regularly have problems embedding fonts in my SWF files.  There are a variety of different ways to embed fonts; many of which are detailed in the documentation. <span> </span>I am going to show my preferred way to embed fonts that solve many of the problems are arise when embedding fonts in other ways.</span></p>
<p><span>One of the biggest issues that I have run into is making a font available for use in both a .css file and in a TextFormat object.<span> </span>It is difficult for me to reference a font that is embedded in a .css file from an AS3 code line that is setting the properties of a new TextFormat object, for instance. <span> </span>This solution also works with both projects that use the mx.core.* framework (a Flex Project) and also pure AS3 projects. <span> </span>This solution works with BitmapFonts like the ones you might find on <a href="http://www.fontsforflash.com/">http://www.fontsforflash.com/</a>.</span></p>
<p>The solution involves making a Fonts.as class that embeds the font definitions and registers them with the global Font object.  This enables referencing of fonts by name from anywhere within your application - CSS, AS3, or MXML files.  I like to make a Flex Library project to hold all the font information.  This allows me to use the same embed code for multiple project - and if desired - make the font.swc into an RSL for runtime sharing between multiple SWFs on your Web site.  You could potentially also achieve runtime loaded font definitions with this method - but that is a story for a different day.</p>
<h2><span><span style="color: #0000ff;"><strong><span style="color: #008000;">PART 1</span></strong><span style="color: #008000;"> - Make the</span></span><strong><span style="color: #0000ff;"><span style="color: #008000;"> font Flex Library Project</span></span></strong><span style="color: #0000ff;"><span style="color: #008000;"> project</span></span></span></h2>
<p><span><strong>Step 1</strong> – Open <strong>Flex Builder</strong> and make a new <strong>Flex Library Project</strong>.<span> </span>Name the project <strong>font</strong>.</span></p>
<p><span><strong>Step 2</strong> – Add font assets.<span> </span>I prefer to create a src/assets/fonts/ directory to hold my assets.<span> </span>The font assets can be either<br />
A) .TTF file<br />
B). SWF file by following the instructions from the docs found here: <a title="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html" href="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html" target="_blank">http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html</a></span></p>
<p><span><strong>Step 3</strong> – Create a new .as file in your /src directory named <strong>Fonts.as</strong></span></p>
<p><strong>Step 4</strong> - Add this code to <strong>Fonts.as</strong></p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a>;
&nbsp;
	<span style="color: #3f5fbf;">/**
	 *  This class sets up the fonts for the application.
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Fonts
	<span style="color: #000000;">&#123;</span>
	<span style="color: #009900;">// Embed a TTF file</span>
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/BOOTLE__.TTF'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'BOOTLE'</span>, mimeType=<span style="color: #990000;">'application/x-font'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #009900;">// http://famousfonts.smackbomb.com/fonts/thebeatles.php</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> BOOTLE<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/squealer.TTF'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Squealer'</span>, mimeType=<span style="color: #990000;">'application/x-font'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #009900;">// http://famousfonts.smackbomb.com/fonts/acdc.php</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> Squealer<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
        <span style="color: #009900;">// Embed a font located inside a SWF file</span>
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45Light<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span>, fontWeight=<span style="color: #990000;">'bold'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45LightBold<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span>, <span style="color: #004993;">fontStyle</span>=<span style="color: #990000;">'italic'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45LightItalic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span>, fontWeight=<span style="color: #990000;">'bold'</span>, <span style="color: #004993;">fontStyle</span>=<span style="color: #990000;">'italic'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45LightBoldItalic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Constuctor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Fonts<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">// Register the font with the global Font manager class</span>
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>BOOTLE<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>Squealer<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45Light<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45LightBold<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45LightItalic<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45LightBoldItalic<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * A utility function
		 *
		 * @param font	A font object
		 * @return 	A sting of the font name combined with the font style
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> getUniqueFontName<span style="color: #000000;">&#40;</span><span style="color: #004993;">font</span><span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">String</span></a>
		<span style="color: #000000;">&#123;</span>
            		<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">font</span>.<span style="color: #004993;">fontName</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;:&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">font</span>.<span style="color: #004993;">fontStyle</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #009900;">// A convienent place to declare TextFormat objects that will be used in multiple location</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat1<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Squealer&quot;</span>, <span style="color: #000000; font-weight:bold;">12</span>, 0x000000<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat2<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;BOOTLE&quot;</span>, <span style="color: #000000; font-weight:bold;">12</span>, 0x000000<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3Bold<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3Italic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000, <span style="color: #0033ff; font-weight: bold;">null</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3BoldItalic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000, <span style="color: #0033ff; font-weight: bold;">true</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<h2><span><span style="color: #0000ff;"><span style="color: #008000;">PART 2 – Make a project(s) that will use the </span></span><strong><span style="color: #0000ff;"><span style="color: #008000;">font Flex Library Project</span></span></strong></span></h2>
<p><span><strong>- AS3 PROJECT</strong> –<br />
<strong>Step 1</strong> - Create a new <strong>ActionScript Project</strong><span>  </span>(File --&gt;</span><span> New --&gt;</span><span> ActionScript Project)</span></p>
<ul>
<li>Name the project <strong>AS3FontTest</strong></li>
<li>Click<strong> Next </strong>button</li>
<li>Click <strong>Library Path</strong> tab</li>
<li>Click <strong>Add Project </strong>button</li>
<li>Select<strong> font </strong>and click<strong> OK</strong></li>
<li>Click<strong> Finish </strong>button</li>
</ul>
<p><strong></strong></p>
<p><strong> </strong><br />
<strong>Step 2</strong> - Add this code to the AS3FontTest.as file</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Sprite</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<a href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagealign.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageAlign</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageScaleMode</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=antialiastype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:antialiastype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">AntiAliasType</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=gridfittype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:gridfittype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">GridFitType</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a>;
&nbsp;
	<span style="color: #009900;">// Use meta-data to set the height and width of the SWF</span>
	<span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;200&quot;</span>, <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;200&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 *  Class used to test embeded font
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> AS3FontTest extends <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> yPos<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">0</span>;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Constructor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AS3FontTest<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">// Set some SWF paramaters</span>
			<span style="color: #004993;">stage</span>.<span style="color: #004993;">scaleMode</span> = <a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageScaleMode</span></a>.<span style="color: #004993;">NO_SCALE</span>;
			<span style="color: #004993;">stage</span>.<span style="color: #004993;">align</span> = <a href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagealign.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageAlign</span></a>.<span style="color: #004993;">TOP_LEFT</span>;
&nbsp;
			<span style="color: #009900;">// Draw the text</span>
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat1<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// Use the static instance of a TextFormat object from the Fonts.as class</span>
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat2<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3Bold<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3Italic<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3BoldItalic<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Method used to draw the UI bits and attach them to the screen
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>textFormat<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			tf = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			tf.<span style="color: #004993;">defaultTextFormat</span> = textFormat;
			tf.<span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
			tf.<span style="color: #004993;">antiAliasType</span> = <a href="http://www.google.com/search?q=antialiastype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:antialiastype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">AntiAliasType</span></a>.<span style="color: #004993;">ADVANCED</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">thickness</span> = <span style="color: #000000; font-weight:bold;">0</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">sharpness</span> = <span style="color: #000000; font-weight:bold;">0</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">gridFitType</span> = <a href="http://www.google.com/search?q=gridfittype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:gridfittype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">GridFitType</span></a>.<span style="color: #004993;">SUBPIXEL</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span>;
			tf.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">10</span> <span style="color: #000000; font-weight: bold;">+</span> yPos;
			tf.<span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">180</span>;
			tf.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;ABC123&quot;</span>;
&nbsp;
			<span style="color: #009900;">// Add the created TextField to the stage</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span>;
&nbsp;
			yPos <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000; font-weight:bold;">18</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p><strong>Step 3</strong> - Run the project and you should see the embedded font(s) as expected<strong></strong></p>
<p><span><strong>- FLEX PROJECT –</strong><br />
<strong>Step 1</strong> - Create a new <strong>Flex Project <span><span style="font-weight: normal;">(File --&gt;</span></span><span><span style="font-weight: normal;"> New --&gt;</span></span><span><span style="font-weight: normal;"> ActionScript Project)</span></span></strong></span></p>
<ul>
<li>Name the project <strong>FlexFontTest</strong></li>
<li>Click <strong>Next </strong>button</li>
<li>Click <strong>Library Path</strong> tab</li>
<li>Click <strong>Add Project</strong> button</li>
<li>Select <strong>font </strong>and click <strong>OK</strong></li>
<li>Click <strong>Finish </strong>button</li>
</ul>
<p><span><strong>Step 2 -</strong> Make a new directory <strong>/src/assets/styles</strong></span></p>
<p><span><strong>Step 3</strong> -  Make a new CSS file in that directory named <strong>styles.css</strong><br />
<strong>Step 4</strong> -  Add this code to <strong>styles.css</strong></span></p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/* CSS file */</span>
.bootle <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;BOOTLE&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.squealer <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Squealer&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutiger <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutigerBold <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>weight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">bold</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutigerItalic <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>style<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">italic</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutigerBoldItalic <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>weight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">bold</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>style<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">italic</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span></pre>
<p><strong>Step 5</strong> -  Add this code to the <strong>FlexFontText.mxml </strong>file that was created when you made the project<br />
<code></p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span>
	creationComplete=<span style="color: #990000;">&quot;created()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
			<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> created<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #009900;">// Instantiate the Fonts class</span>
				<span style="color: #0033ff; font-weight: bold;">new</span> Fonts<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #009900;">// Reference the embeded font name by it's string name</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
				tf.<span style="color: #004993;">defaultTextFormat</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">12</span>, 0x000000<span style="color: #000000;">&#41;</span>;
				tf.<span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
				tf.<span style="color: #004993;">antiAliasType</span> = <a href="http://www.google.com/search?q=antialiastype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:antialiastype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">AntiAliasType</span></a>.<span style="color: #004993;">ADVANCED</span>;
				tf.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;ABC 123&quot;</span>;
&nbsp;
				fontHolder.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Style <span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;/assets/styles/styles.css&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>VBox <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>UIComponent id=<span style="color: #990000;">&quot;fontHolder&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;20&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;bootle&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;squealer&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutiger&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutigerBold&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutigerItalic&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutigerBoldItalic&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>VBox<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p></code></p>
<p><span><strong>Step 6</strong> - Run the project and you should see the embedded font(s)</span></p>
<p><span>I hope this illustrated a way to simplify font embedding in Flash that allows for use in TextFormat object or in CSS files.</span></p>
<p><span>--jason</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/03/20/embeding-fonts-for-use-in-textformat-and-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Parameters With The Same Name Using URLVariables</title>
		<link>http://www.themorphicgroup.com/blog/2009/03/20/setting-parameters-with-the-same-name-using-urlvariables/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/03/20/setting-parameters-with-the-same-name-using-urlvariables/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 12:34:54 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[URLVariables]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=77</guid>
		<description><![CDATA[The ability to set and send form parameters with the same name is available with URLVariables though it's not quite documented very well (at all?). Below are 4 examples of setting 2 values with same parameter name. The first example results in 1 parameter. The rest result in 2 parameters as expected. &#160; // results [...]]]></description>
			<content:encoded><![CDATA[<p>The ability to set and send form parameters with the same name is available with URLVariables though it's not quite documented very well (at all?).</p>
<p>Below are 4 examples of setting 2 values with same parameter name. The first example results in 1 parameter. The rest result in 2 parameters as expected.</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #009900;">// results in 1 parameter</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsA<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
urlVarsA<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;Hello&quot;</span>;
urlVarsA<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;World!&quot;</span>; <span style="color: #009900;">// this overwrites the previous</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsA<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=World%21</span>
&nbsp;
<span style="color: #009900;">// results in 2 parameters as expected</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsB<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
urlVarsB.<span style="color: #004993;">decode</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;foo=Hello&quot;</span><span style="color: #000000;">&#41;</span>;
urlVarsB.<span style="color: #004993;">decode</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;foo=World!&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// decode() has logic to detect existing params</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsB<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=Hello&amp;foo=World%21</span>
&nbsp;
<span style="color: #009900;">// results in 2 parameters as expected</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsC<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;foo=Hello&amp;foo=World!&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsC<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=Hello&amp;foo=World%21</span>
&nbsp;
<span style="color: #009900;">// results in 2 parameters as expected</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsD<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
urlVarsD<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;Hello&quot;</span>, <span style="color: #990000;">&quot;World!&quot;</span><span style="color: #000000;">&#93;</span>; <span style="color: #009900;">// Arrays are special to URLVariables</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsD<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=Hello&amp;foo=World%21</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/03/20/setting-parameters-with-the-same-name-using-urlvariables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
