<?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; easing</title>
	<atom:link href="http://blog.flexexamples.com/tag/easing/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>Changing the default easing function on a Wipe effect</title>
		<link>http://blog.flexexamples.com/2007/10/11/changing-the-default-easing-function-on-a-wipe-effect/</link>
		<comments>http://blog.flexexamples.com/2007/10/11/changing-the-default-easing-function-on-a-wipe-effect/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 06:56:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Effects]]></category>
		<category><![CDATA[Elastic]]></category>
		<category><![CDATA[WipeLeft]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[moveEasingFunction]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/11/changing-the-default-easing-function-on-a-wipe-effect/</guid>
		<description><![CDATA[<p>The following example shows how you can customize the move easing function on a wipe effect.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/WipeLeft_moveEasingFunction_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/10/11/changing-the-default-easing-function-on-a-wipe-effect/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.effects.easing.*; ]]&#62; &#60;/mx:Script&#62; &#60;mx:WipeLeft id="wipeLeft" target="{image}" moveEasingFunction="Elastic.easeOut" duration="5000" /&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Button label="Start wipe" click="wipeLeft.play();" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can customize the move easing function on a wipe effect.</p>
<p>Full code after the jump.</p>
<p><span id="more-230"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/WipeLeft_moveEasingFunction_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/11/changing-the-default-easing-function-on-a-wipe-effect/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.effects.easing.*;
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:WipeLeft id="wipeLeft"
            target="{image}"
            moveEasingFunction="Elastic.easeOut"
            duration="5000" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Button label="Start wipe"
                click="wipeLeft.play();" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Image id="image"
            source="assets/flex_sm.png" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/WipeLeft_moveEasingFunction_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/WipeLeft_moveEasingFunction_test/bin/main.html" width="100%" height="360"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the default easing function on a Wipe effect on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/11/changing-the-default-easing-function-on-a-wipe-effect/',contentID: 'post-230',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'easing,moveEasingFunction',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/11/changing-the-default-easing-function-on-a-wipe-effect/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Customizing the slide duration and slide easing function on a Flex slider control</title>
		<link>http://blog.flexexamples.com/2007/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/</link>
		<comments>http://blog.flexexamples.com/2007/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 03:21:28 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[HSlider]]></category>
		<category><![CDATA[Slider]]></category>
		<category><![CDATA[VSlider]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[slideDuration]]></category>
		<category><![CDATA[slideEasingFunction]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/</guid>
		<description><![CDATA[<p>The following example shows how you can customize the duration and easing function used when a user clicks on a thumb track on an HSlider or VSlider control in Flex.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Slider_slideDuration_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init();"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can customize the duration and easing function used when a user clicks on a thumb track on an HSlider or VSlider control in Flex.</p>
<p>Full code after the jump.</p>
<p><span id="more-172"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Slider_slideDuration_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/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;
            import mx.events.NumericStepperEvent;
            import mx.effects.easing.*;

            private var arr:Array;

            private function init():void {
                arr = new Array();
                arr.push({label:"Elastic.easeInOut", func:Elastic.easeInOut});
                arr.push({label:"Bounce.easeOut", func:Bounce.easeOut});
                arr.push({label:"Back.easeIn", func:Back.easeIn});

                easingFunc.dataProvider = arr;
            }

            private function duration_change(evt:NumericStepperEvent):void {
                slider.setStyle("slideDuration", evt.value);
            }

            private function easingFunc_change(evt:ListEvent):void {
                slider.setStyle("slideEasingFunction", easingFunc.selectedItem.func);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label text="slideDuration:" /&gt;
        &lt;mx:NumericStepper id="duration"
                minimum="0"
                maximum="2000"
                value="300"
                stepSize="100"
                change="duration_change(event);" /&gt;

        &lt;mx:Label text="slideEasingFunction:" /&gt;
        &lt;mx:ComboBox id="easingFunc"
                change="easingFunc_change(event);"
                prompt="Please select an easing function..." /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:HSlider id="slider" showTrackHighlight="true" tickInterval="1" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Slider_slideDuration_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Slider_slideDuration_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Customizing the slide duration and slide easing function on a Flex slider control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/',contentID: 'post-172',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'easing,slideDuration,slideEasingFunction',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/09/12/customizing-the-slide-duration-and-slide-easing-function-on-a-flex-slider-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the Accordion container&#8217;s easing duration and easing functions</title>
		<link>http://blog.flexexamples.com/2007/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/</link>
		<comments>http://blog.flexexamples.com/2007/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 05:57:19 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Accordion]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[openDuration]]></category>
		<category><![CDATA[openEasingFunction]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/</guid>
		<description><![CDATA[<p>The following example shows how you can control the easing duration and easing function that the Accordion container uses when changing the visible child container.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Accordion_openEasingFunction_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init()"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.effects.easing.*; private function init():void { [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can control the easing duration and easing function that the Accordion container uses when changing the visible child container.</p>
<p>Full code after the jump.</p>
<p><span id="more-139"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Accordion_openEasingFunction_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/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init()"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.effects.easing.*;

            private function init():void {
                /**    Back */
                arrColl.addItem({label:"Back.easeIn", func:Back.easeIn});
                arrColl.addItem({label:"Back.easeOut", func:Back.easeOut});
                arrColl.addItem({label:"Back.easeInOut", func:Back.easeInOut});
                /** Bounce */
                arrColl.addItem({label:"Bounce.easeIn", func:Bounce.easeIn});
                arrColl.addItem({label:"Bounce.easeOut", func:Bounce.easeOut});
                arrColl.addItem({label:"Bounce.easeInOut", func:Bounce.easeInOut});
                /** Circular */
                arrColl.addItem({label:"Circular.easeIn", func:Circular.easeIn});
                arrColl.addItem({label:"Circular.easeOut", func:Circular.easeOut});
                arrColl.addItem({label:"Circular.easeInOut", func:Circular.easeInOut});
                /** Cubic */
                arrColl.addItem({label:"Cubic.easeIn", func:Cubic.easeIn});
                arrColl.addItem({label:"Cubic.easeOut", func:Cubic.easeOut});
                arrColl.addItem({label:"Cubic.easeInOut", func:Cubic.easeInOut});
                /** Elastic */
                arrColl.addItem({label:"Elastic.easeIn", func:Elastic.easeIn});
                arrColl.addItem({label:"Elastic.easeOut", func:Elastic.easeOut});
                arrColl.addItem({label:"Elastic.easeInOut", func:Elastic.easeInOut});
                /** Exponential */
                arrColl.addItem({label:"Exponential.easeIn", func:Exponential.easeIn});
                arrColl.addItem({label:"Exponential.easeOut", func:Exponential.easeOut});
                arrColl.addItem({label:"Exponential.easeInOut", func:Exponential.easeInOut});
                /** Linear */
                arrColl.addItem({label:"Linear.easeIn", func:Linear.easeIn});
                arrColl.addItem({label:"Linear.easeOut", func:Linear.easeOut});
                arrColl.addItem({label:"Linear.easeInOut", func:Linear.easeInOut});
                /** Quadratic */
                arrColl.addItem({label:"Quadratic.easeIn", func:Quadratic.easeIn});
                arrColl.addItem({label:"Quadratic.easeOut", func:Quadratic.easeOut});
                arrColl.addItem({label:"Quadratic.easeInOut", func:Quadratic.easeInOut});
                /** Quartic */
                arrColl.addItem({label:"Quartic.easeIn", func:Quartic.easeIn});
                arrColl.addItem({label:"Quartic.easeOut", func:Quartic.easeOut});
                arrColl.addItem({label:"Quartic.easeInOut", func:Quartic.easeInOut});
                /** Quintic */
                arrColl.addItem({label:"Quintic.easeIn", func:Quintic.easeIn});
                arrColl.addItem({label:"Quintic.easeOut", func:Quintic.easeOut});
                arrColl.addItem({label:"Quintic.easeInOut", func:Quintic.easeInOut});
                /** Sine */
                arrColl.addItem({label:"Sine.easeIn", func:Sine.easeIn});
                arrColl.addItem({label:"Sine.easeOut", func:Sine.easeOut});
                arrColl.addItem({label:"Sine.easeInOut", func:Sine.easeInOut});
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ArrayCollection id="arrColl" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label text="openEasingFunction:" /&gt;
        &lt;mx:ComboBox id="openEasingFunc"
                dataProvider="{arrColl}" /&gt;

        &lt;mx:Label text="openDuration:" /&gt;
        &lt;mx:HSlider id="openDur"
                minimum="100"
                maximum="1500"
                value="1000"
                liveDragging="true"
                snapInterval="100"
                tickInterval="100"
                dataTipPrecision="0" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Accordion width="400" height="120"
            openDuration="{openDur.value}"
            openEasingFunction="{openEasingFunc.selectedItem.func}"&gt;
        &lt;mx:VBox id="child1" label="Child 1" /&gt;
        &lt;mx:VBox id="child2" label="Child 2" /&gt;
        &lt;mx:VBox id="child3" label="Child 3" /&gt;
    &lt;/mx:Accordion&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Accordion_openEasingFunction_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Accordion_openEasingFunction_test/bin/main.html" width="100%" height="250"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the Accordion container\&#039;s easing duration and easing functions on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/',contentID: 'post-139',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'easing,openDuration,openEasingFunction',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/08/27/changing-the-accordion-containers-easing-duration-and-easing-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Specifying certain unicode-ranges for embedded fonts</title>
		<link>http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/</link>
		<comments>http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 05:15:44 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Embed]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>
		<category><![CDATA[unicode range]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/</guid>
		<description><![CDATA[<p>In a previous post (&#8220;<a href="http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/">Embedding and animating fonts in a Flex application</a>&#8220;), we looked at embedding a font in a Flex application so we could animate, rotate, and set the alpha for a Text control. Well, as we learnt, sometimes embedding a whole font face can dramatically increase the size of the final SWF [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post (&#8220;<a href="http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/">Embedding and animating fonts in a Flex application</a>&#8220;), we looked at embedding a font in a Flex application so we could animate, rotate, and set the alpha for a Text control. Well, as we learnt, sometimes embedding a whole font face can dramatically increase the size of the final SWF output. In this post we&#8217;ll look at only specifying a certain range of characters for an embedded font, which will help reduce file sizes.</p>
<p>Full code after the jump.</p>
<p><span id="more-66"></span></p>
<p>Before we get too far, we&#8217;ll quickly look at some of the font basics. If you&#8217;re a Windows user, a good place to start is with the Character Map application. Its a little Window&#8217;s utility that gets installed on most modern operating systems and lets you quickly browse a font&#8217;s supported characters, different character sets, filter characters by Unicode subranges, search for certain characters (such as &copy; or &reg;), see a characters Unicode value as well as character code. It also lets you quickly copy certain characters to the clipboard for easy copy-pasting between applications. Because I can never remember where the application gets installed, or where to find its icon, it is usually just easiest to type &#8220;charmap&#8221; from a command prompt. If you have a modern-day keyboard, hit Windows+R to bring up the Run dialog, type &#8220;charmap&#8221;, hit Enter, and get ready to be amazed! Most of the features I mentioned before are cleverly hidden behind the &#8220;Advanced view&#8221; checkbox, so if you&#8217;re feeling up to the challenge check that checkbox to go to advanced view, otherwise the basic view will do just fine for now. At the top of the Character Map application is a Font drop down menu which lists all the fonts you currently have installed on your system. If you just downloaded a TrueType font (TTF) and didn&#8217;t install it into the Fonts directory (C:\Windows\Fonts by default), it won&#8217;t be listed here. Don&#8217;t worry if your specific font isn&#8217;t listed here, it isn&#8217;t the end of the world. Select any old font and click around.</p>
<p>If you want to embed the numbers 0-9, you would click on &#8220;0&#8243; and note it&#8217;s Unicode value (U+0030), then click on &#8220;9&#8243; and do the same (U+0039). Now, in your Flex application, you would specify this range in the @font-family style block like so:</p>
<pre class="code">
unicode-range: U+0030-U+0039;
</pre>
<p>If you wanted to specify multiple ranges, you would just separate them with commas:</p>
<pre class="code">
unicode-range:
    U+0030-U+0039, /* 0-9 */
    U+0041-U+0051, /* Uppercase A-Z */
    U+0052-U+007A; /* Lowercase a-z */
</pre>
<p>And if you just want to embed the whole range of all uppercase, lowercase, punctuation, and symbols, you could just specify the following unicode range:</p>
<pre class="code">
@font-face {
    src: url('assets/base02.ttf');
    font-family: Base02;
    unicode-range: U+0021-U+007B; /* whole range of uppercase, lowercase, symbols and punctuation. */
}
</pre>
<p>Again, use the character map if you want to find additional character such as the copyright symbol (&#0169;) or other symbols.</p>
<p class="alert">Remember, all fonts may not include special &#8220;extended&#8221; characters such as copyright symbols, dollar signs, fractions, pound signs, euro signs, etc. Make sure you check that your font includes the characters you need.</p>
<p>Now, with that out of the way, lets look at a full sample of unicode-range embedding in action!</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test_2/main1.mxml">View MXML</a></p>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            /* Import all the easing classes so its
               easier to switch between them on the
               fly without tweaking import statements. */
            import mx.effects.easing.*;
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: url('assets/base02.ttf');
            font-family: Base02;
            unicode-range: U+0021-U+007B; /* whole range of uppercase, lowercase, symbols and punctuation. */
        }

        .MyEmbeddedFont {
            font-family: Base02;
            font-size: 14px;
        }
    &lt;/mx:Style&gt;

    &lt;!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the Elastic.easeOut easing method. --&gt;
    &lt;mx:Zoom id="zoom" duration="2500" easingFunction="Elastic.easeOut" target="{embeddedText}" /&gt;

    &lt;!-- Use advanced font anti-aliasing for the embedded font, set the rotation to 5 degrees, alpha to 80% and loop the animation. --&gt;
    &lt;mx:Text id="embeddedText" text="The quick brown fox jumped over the lazy dog." styleName="MyEmbeddedFont" rotation="5" alpha="0.8" fontAntiAliasType="advanced" creationComplete="zoom.play();" effectEnd="zoom.play()" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Shocking? No, not really, because we saw the new unicode-range style earlier in the pre-code discussion. But what kind of filesize savings did we encounter by only embedding a &#8220;small range&#8221; of characters? Well, in this case, none really. The Base02 font really only has the regular letters, numbers, punctuation and symbols to begin with, so our SWF size is still ~260 KB, same as the previous article where we didn&#8217;t specify a range at all.</p>
<p>But what if we only specify the exact characters that we need, the uppercase &#8220;T&#8221;, full range of lowercase letters and the period? Well, as luck has it, I did just that:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test_2/main2.mxml">View MXML</a></p>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            /* Import all the easing classes so its
               easier to switch between them on the
               fly without tweaking import statements. */
            import mx.effects.easing.*;
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Style&gt;
        @font-face {
            src: url('assets/base02.ttf');
            font-family: Base02;
            unicode-range:
                U+0054-U+0054, /* T */
                U+0061-U+007A, /* a-z */
                U+002E-U+002E; /* . (period) */
        }

        .MyEmbeddedFont {
            font-family: Base02;
            font-size: 14px;
        }
    &lt;/mx:Style&gt;

    &lt;!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the Elastic.easeOut easing method. --&gt;
    &lt;mx:Zoom id="zoom" duration="2500" easingFunction="Elastic.easeOut" target="{embeddedText}" /&gt;

    &lt;!-- Use advanced font anti-aliasing for the embedded font, set the rotation to 5 degrees, alpha to 80% and loop the animation. --&gt;
    &lt;mx:Text id="embeddedText" text="The quick brown fox jumped over the lazy dog." styleName="MyEmbeddedFont" rotation="5" alpha="0.8" fontAntiAliasType="advanced" creationComplete="zoom.play();" effectEnd="zoom.play()" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Yeah, the same big snippet for a minor little tweak, but hey. I&#8217;m sure it makes somebody&#8217;s life easier if they can grab all the code in one place instead of copying from two sources.</p>
<p>So, with the bare minimum of characters embedded, what is the new file size of the SWF? My main SWF file is now down to 193 KB (down from ~260 KB), which is about 74% of its original size, and only 46 KB larger than the same example without any embedded font. Not too bad for a tiny bit of work! Of course, its pretty easy when you know exactly which characters are used. If we were using the font for multiple text fields or a TextInput/TextArea control you would probably need to embed the whole range of characters since you couldn&#8217;t be sure of what the user would be entering.</p>
<p class="information">View source is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test_2/bin/main.html" width="100%" height="200"></iframe></p>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Specifying certain unicode-ranges for embedded fonts on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/',contentID: 'post-66',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,easing,fontAntiAliasType,unicode range',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/08/07/specifying-certain-unicode-ranges-for-embedded-fonts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Embedding and animating fonts in a Flex application</title>
		<link>http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/</link>
		<comments>http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 05:58:28 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Embed]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[Zoom]]></category>
		<category><![CDATA[@font face]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[fontAntiAliasType]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/</guid>
		<description><![CDATA[<p>I meant to post this earlier, and I already touched on font embedding in an earlier post (<a href="http://blog.flexexamples.com/2007/08/05/building-a-basic-controller-for-the-videodisplay-control/">Building a basic controller for the VideoDisplay control</a>), but here&#8217;s a quick little way to embed a font in a Flex application.</p> <p>In this example we embed a font (the awesome &#8220;Base 02&#8243; PC TrueType font (TTF) [...]]]></description>
			<content:encoded><![CDATA[<p>I meant to post this earlier, and I already touched on font embedding in an earlier post (<a href="http://blog.flexexamples.com/2007/08/05/building-a-basic-controller-for-the-videodisplay-control/">Building a basic controller for the VideoDisplay control</a>), but here&#8217;s a quick little way to embed a font in a Flex application.</p>
<p>In this example we embed a font (the awesome &#8220;Base 02&#8243; PC TrueType font (TTF) from <a href="http://www.stereo-type.net/">http://www.stereo-type.net/</a>), animate it using the Zoom effect and the Elastic.easeOut easing method. We also set the <code>rotation</code> and <code>alpha</code> properties (which you can&#8217;t do with non-embedded fonts), and we set the <code>fontAntiAliasType</code> to &#8220;advanced&#8221; to give the font a cleaner look. Finally we use the <code>effectEnd</code> event to loop the animation.</p>
<p><span id="more-62"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test/main.mxml">View MXML</a></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/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Font_antiAliasType_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            /* Import all the easing classes so its easier to switch between</span>
<span style="color: #339933;">               them on the fly without tweaking import statements. */</span>
<span style="color: #339933;">            import mx.effects.easing.*;</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        @font-face {
            src: url('assets/base02.ttf');
            font-family: Base02;
        }
&nbsp;
        .MyEmbeddedFont {
            font-family: Base02;
            font-size: 16px;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the </span>
<span style="color: #000000;">         Elastic.easeOut easing method. --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Zoom</span> id=<span style="color: #ff0000;">&quot;zoom&quot;</span></span>
<span style="color: #000000;">            duration=<span style="color: #ff0000;">&quot;2500&quot;</span></span>
<span style="color: #000000;">            easingFunction=<span style="color: #ff0000;">&quot;Elastic.easeOut&quot;</span></span>
<span style="color: #000000;">            target=<span style="color: #ff0000;">&quot;{embeddedText}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Use advanced font anti-aliasing for the embedded font, set the rotation</span>
<span style="color: #000000;">         to 5 degrees, alpha to 80% and loop the animation. --&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> id=<span style="color: #ff0000;">&quot;embeddedText&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;The quick brown fox jumped over the lazy dog.&quot;</span></span>
<span style="color: #000000;">            styleName=<span style="color: #ff0000;">&quot;MyEmbeddedFont&quot;</span></span>
<span style="color: #000000;">            rotation=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">            alpha=<span style="color: #ff0000;">&quot;0.8&quot;</span></span>
<span style="color: #000000;">            fontAntiAliasType=<span style="color: #ff0000;">&quot;advanced&quot;</span></span>
<span style="color: #000000;">            creationComplete=<span style="color: #ff0000;">&quot;zoom.play();&quot;</span></span>
<span style="color: #000000;">            effectEnd=<span style="color: #ff0000;">&quot;zoom.play()&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Font_antiAliasType_test/bin/main.html" width="100%" height="200"></iframe></p>
<p class="alert">Base 02 font by <a href="http://www.stereo-type.net/">www.stereo-type.net</a>.</p>
<p class="alert">It is important to note that embedding fonts can dramatically increase the size of generated SWFs. The size of the SWF above is roughly 260 KB (the base02.ttf file (not included in the ZIP) on its own is 177 KB). By comparison, if embedded fonts were not used, the file size of the SWF would have been only 147 KB, although the rotation and alpha effects would not have been possible. In a future entry I&#8217;ll cover how to embed certain characters/ranges of a font-face to reduce the overall size.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Embedding and animating fonts in a Flex application on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/06/embedding-and-animating-fonts-in-a-flex-application/',contentID: 'post-62',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '@font face,easing,fontAntiAliasType',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/08/06/embedding-and-animating-fonts-in-a-flex-application/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

