<?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>Flex Examples &#187; local()</title>
	<atom:link href="http://blog.flexexamples.com/tag/local/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Embedding local system fonts in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:48:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[load config]]></category>
		<category><![CDATA[local()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2311</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/">&#8220;Embedding fonts by name instead of location&#8221;</a>, we saw how you could embed a font in Flex by specifying the font name instead of a location by using the local() function instead of the src() function when embedding a font.</p> <p>The following example shows how you can load a system [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/">&#8220;Embedding fonts by name instead of location&#8221;</a>, we saw how you could  embed a font in Flex by specifying the font name instead of a location by using the <code>local()</code> function instead of the <code>src()</code> function when embedding a font.</p>
<p>The following example shows how you can load a system font in Flex 4 by specifying a custom Flex configuration file and specifying a local font path.</p>
<p>Full code after the jump.</p>
<p><span id="more-2311"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_fontFace_local_test&quot;</span></span>
<span style="color: #000000;">               xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">               xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- -load-config+=local-font-config.xml --&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @namespace s &quot;library://ns.adobe.com/flex/spark&quot;;
&nbsp;
        @font-face {
            src: local(&quot;Arial&quot;);
            fontFamily: &quot;MyFont&quot;;
            unicodeRange: U+0020-00FF;
        }
&nbsp;
        s|Label {
            fontFamily: &quot;MyFont&quot;;
            fontSize: 44;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;myLabel&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;Hello World&quot;</span></span>
<span style="color: #000000;">            rotation=<span style="color: #ff0000;">&quot;15&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Next we need to create a custom Flex config file (in this case <em>local-font-config.xml</em>, and save this file in your project&#8217;s /src/ folder) and specify a local font path, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flex-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;compiler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fonts<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;local-font-paths<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path-element<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:/Temp/fonts<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path-element<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #808080; font-style: italic;">&lt;!--&lt;path-element&gt;/System/Library/Fonts/&lt;/path-element&gt;--&gt;</span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/local-font-paths<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fonts<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/compiler<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flex-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In the previous config file, you specify a folder where the Flex compiler should look for &#8220;local&#8221; fonts. In this case I have a C:\Temp\fonts\ folder which has a series of subdirectories containing .TTF and .OTF fonts.</p>
<p>Finally, you need to specify the custom config file in Flash Builder&#8217;s project properties dialog box (for more information, see <a href="http://blog.flexexamples.com/2008/12/21/using-a-custom-flex-configxml-file-in-flex-builder-3/">&#8220;Using a custom flex-config.xml file in Flex Builder 3&#8243;</a>).</p>
<ol>
<li>Select Project &gt; Properties from Flex Builder&#8217;s main menu.</li>
<li>Select &#8220;Flex Compiler&#8221; from the left hand menu.</li>
<li>In the Additional compiler arguments text field add the following argument: <strong><em>-load-config+=local-font-config.xml</em></strong></li>
</ol>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Embedding local system fonts in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/',contentID: 'post-2311',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,Gumbo,load config,local()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2010/01/21/embedding-local-system-fonts-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating a custom creation complete effect on a Flex Alert control</title>
		<link>http://blog.flexexamples.com/2007/10/12/creating-a-custom-creation-complete-effect-on-a-flex-alert-control/</link>
		<comments>http://blog.flexexamples.com/2007/10/12/creating-a-custom-creation-complete-effect-on-a-flex-alert-control/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 17:07:01 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Alert]]></category>
		<category><![CDATA[Fade]]></category>
		<category><![CDATA[Parallel]]></category>
		<category><![CDATA[Rotate]]></category>
		<category><![CDATA[Sequence]]></category>
		<category><![CDATA[Zoom]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[creationCompleteEffect]]></category>
		<category><![CDATA[local()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/12/creating-a-custom-creation-complete-effect-on-a-flex-alert-control/</guid>
		<description><![CDATA[<p>The following example shows how to specify an effect which gets played when an Alert control is displayed by setting the Alert control&#8217;s creationCompleteEffect style. You can also see how to embed both the normal and bold font using CSS and @font-face.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_creationCompleteEffect_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how to specify an effect which gets played when an Alert control is displayed by setting the Alert control&#8217;s <code>creationCompleteEffect</code> style. You can also see how to embed both the normal and bold font using CSS and @font-face.</p>
<p>Full code after the jump.</p>
<p><span id="more-231"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_creationCompleteEffect_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/10/12/creating-a-custom-creation-complete-effect-on-a-flex-alert-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: local("Verdana");
            fontFamily: VerdanaEmbedded;
        }

        @font-face {
            src: local("Verdana");
            fontFamily: VerdanaEmbedded;
            fontWeight: bold;
        }

        Alert {
            fontFamily: VerdanaEmbedded;
            creationCompleteEffect: myEffect;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;

            private var alert:Alert;

            private function button_click():void {
                alert = Alert.show("The quick brown fox jumped over the lazy dog", "Lorem Ipsum");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Sequence id="myEffect"&gt;
        &lt;mx:Parallel&gt;
            &lt;mx:Zoom /&gt;
            &lt;mx:Fade /&gt;
        &lt;/mx:Parallel&gt;
        &lt;mx:Rotate /&gt;
    &lt;/mx:Sequence&gt;

    &lt;mx:Button label="Launch Alert" click="button_click();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Alert_creationCompleteEffect_test/bin/main.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Alert_creationCompleteEffect_test/bin/main.html" width="100%" height="400"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a custom creation complete effect on a Flex Alert control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/12/creating-a-custom-creation-complete-effect-on-a-flex-alert-control/',contentID: 'post-231',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,creationCompleteEffect,local()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/10/12/creating-a-custom-creation-complete-effect-on-a-flex-alert-control/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Embedding fonts by name instead of location</title>
		<link>http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/</link>
		<comments>http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 14:46:00 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Embed]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[local()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/</guid>
		<description><![CDATA[<p>The following example shows how you can embed a font in Flex by specifying the font name instead of a location by using the local() function instead of the src() function when embedding a font.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Embed_fonts_test_4/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can embed a font in Flex by specifying the font name instead of a location by using the <code>local()</code> function instead of the <code>src()</code> function when embedding a font.</p>
<p>Full code after the jump.</p>
<p><span id="more-225"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Embed_fonts_test_4/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        applicationComplete="init();"&gt;

    &lt;mx:Style&gt;
        @font-face {
            src:local("Arial");
            fontFamily: ArialEmbedded;
        }

        @font-face {
            src:local("Arial");
            fontFamily: ArialEmbedded;
            fontWeight: bold;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private var bTotal:Number;

            private function init():void {
                bTotal = Application.application.loaderInfo.bytesTotal;
                /* Convert from bytes to kilobytes. */
                lbl.text = (bTotal / 1024).toFixed(2) + " KB";
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label id="lbl" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:ProgressBar id="progressBar"
            label="Loading Flex Application"
            labelPlacement="center"
            fontFamily="ArialEmbedded"
            rotation="15"
            indeterminate="true"
            themeColor="haloSilver" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Embed_fonts_test_4/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Embed_fonts_test_4/bin/main.html" width="100%" height="250"></iframe></p>
<p>For more information on embedding fonts in Flex, see <a href="http://www.adobe.com/livedocs/flex/201/html/fonts_070_05.html">&#8220;Locating embedded fonts&#8221;</a> in the Flex documentation.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Embedding fonts by name instead of location on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/',contentID: 'post-225',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,local()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/10/09/embedding-fonts-by-name-instead-of-location/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

