<?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; duration</title>
	<atom:link href="http://blog.flexexamples.com/tag/duration/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>Fading two images using the CrossFade effect in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/09/21/fading-two-images-using-the-crossfade-effect-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/09/21/fading-two-images-using-the-crossfade-effect-in-flex-4/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 00:58:16 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[play()]]></category>
		<category><![CDATA[stop()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1898</guid>
		<description><![CDATA[<p>The following example shows how you can cross fade two bitmap images using the CrossFade effect in Flex 4.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/09/21/fading-two-images-using-the-crossfade-effect-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_CrossFade_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#60;s:controlBarContent&#62; &#60;mx:Button id=&#34;btn&#34; label=&#34;Play CrossFade effect&#34; click=&#34;button1_click(event);&#34; /&#62; &#60;/s:controlBarContent&#62; &#160; &#60;fx:Script&#62; &#60;!&#91;CDATA&#91; &#91;Embed&#40;&#34;assets/fl_player_appicon.jpg&#34;&#41;&#93; private const FlashPlayerIcon:Class; &#160; &#91;Embed&#40;&#34;assets/fx_appicon.jpg&#34;&#41;&#93; private [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can cross fade two bitmap images using the CrossFade effect in Flex 4.</p>
<p>Full code after the jump.</p>
<p><span id="more-1898"></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/2009/09/21/fading-two-images-using-the-crossfade-effect-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_CrossFade_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>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> id=<span style="color: #ff0000;">&quot;btn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Play CrossFade effect&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;button1_click(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets/fl_player_appicon.jpg&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            private const FlashPlayerIcon:Class;</span>
&nbsp;
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;assets/fx_appicon.jpg&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            private const FlexPlayerIcon:Class;</span>
&nbsp;
<span style="color: #000000;">            protected function button1_click<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                xFade.stop<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                xFade.bitmapFrom = new FlexPlayerIcon<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.bitmapData;</span>
<span style="color: #000000;">                xFade.bitmapTo = new FlashPlayerIcon<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.bitmapData;</span>
<span style="color: #000000;">                xFade.play<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:CrossFade</span> id=<span style="color: #ff0000;">&quot;xFade&quot;</span> target=<span style="color: #ff0000;">&quot;{logo}&quot;</span> duration=<span style="color: #ff0000;">&quot;3000&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VGroup</span> 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>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Image</span> id=<span style="color: #ff0000;">&quot;logo&quot;</span> source=<span style="color: #ff0000;">&quot;{FlexPlayerIcon}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:VGroup</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 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: 'Fading two images using the CrossFade effect in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/09/21/fading-two-images-using-the-crossfade-effect-in-flex-4/',contentID: 'post-1898',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'BitmapData,duration,Gumbo,play(),stop()',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/2009/09/21/fading-two-images-using-the-crossfade-effect-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Setting the duration of a sound effect in Flex</title>
		<link>http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 06:54:22 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[SoundEffect]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[useDuration]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the duration of a sound effect in Flex by setting the duration and useDuration properties.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_useDuration_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/ --&#62; &#60;mx:Application name="SoundEffect_useDuration_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:SoundEffect id="soundEffect" source="http://www.helpexamples.com/flash/sound/song1.mp3" useDuration="{checkBox.selected}" duration="{slider.value}" /&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form styleName="plain"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the duration of a sound effect in Flex by setting the <code>duration</code> and <code>useDuration</code> properties.</p>
<p>Full code after the jump.</p>
<p><span id="more-761"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_useDuration_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/ --&gt;
&lt;mx:Application name="SoundEffect_useDuration_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:SoundEffect id="soundEffect"
            source="http://www.helpexamples.com/flash/sound/song1.mp3"
            useDuration="{checkBox.selected}"
            duration="{slider.value}" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="useDuration:"&gt;
                &lt;mx:CheckBox id="checkBox"
                        selected="true" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="duration:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0"
                        maximum="5000"
                        value="500"
                        snapInterval="100"
                        tickInterval="100"
                        liveDragging="true"
                        showTrackHighlight="true"
                        enabled="{checkBox.selected}" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem&gt;
                &lt;mx:Button id="btn"
                        label="Play sound effect"
                        mouseDown="soundEffect.stop();"
                        mouseDownEffect="soundEffect" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_useDuration_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/SoundEffect_useDuration_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_useDuration_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/ --&gt;
&lt;mx:Application name="SoundEffect_useDuration_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.controls.Button;
            import mx.controls.CheckBox;
            import mx.controls.HSlider;
            import mx.effects.SoundEffect;
            import mx.events.SliderEvent;

            private var soundEffect:SoundEffect;
            private var checkBox:CheckBox;
            private var slider:HSlider;
            private var btn:Button;

            private function init():void {
                soundEffect = new SoundEffect();
                soundEffect.source = "http://www.helpexamples.com/flash/sound/song1.mp3";

                checkBox = new CheckBox();
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change);

                slider = new HSlider();
                slider.minimum = 0;
                slider.maximum = 5000; /* 5 seconds */
                slider.value = soundEffect.duration;
                slider.snapInterval = 100;
                slider.tickInterval = 100;
                slider.liveDragging = true;
                slider.setStyle("showTrackHighlight", true);
                slider.addEventListener(SliderEvent.CHANGE, slider_change);

                btn = new Button();
                btn.label = "Play sound effect"
                btn.setStyle("mouseDownEffect", soundEffect);
                btn.addEventListener(MouseEvent.MOUSE_DOWN, btn_mouseDown);

                var formItem1:FormItem = new FormItem();
                formItem1.label = "useDuration:";
                formItem1.addChild(checkBox);

                var formItem2:FormItem = new FormItem();
                formItem2.label = "duration:";
                formItem2.addChild(slider);

                var formItem3:FormItem = new FormItem();
                formItem3.addChild(btn);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem1);
                form.addChild(formItem2);
                form.addChild(formItem3);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                Application.application.addChildAt(appControlBar, 0);
            }

            private function checkBox_change(evt:Event):void {
                soundEffect.useDuration = checkBox.selected;
                slider.enabled = checkBox.selected;
            }

            private function slider_change(evt:SliderEvent):void {
                soundEffect.duration = evt.value;
            }

            private function btn_mouseDown(evt:MouseEvent):void {
                soundEffect.stop();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the duration of a sound effect in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/',contentID: 'post-761',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'duration,useDuration',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/2008/08/24/setting-the-duration-of-a-sound-effect-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.helpexamples.com/flash/sound/song1.mp3" length="339517" type="audio/mpeg" />
<enclosure url="http://www.helpexamples.com/flash/sound/song1.mp3" length="339517" type="audio/mpeg" />
<enclosure url="http://www.helpexamples.com/flash/sound/song1.mp3" length="339517" type="audio/mpeg" />
		</item>
		<item>
		<title>Using an easing function with the AnimateProperties class in Flex and Flash Player 10</title>
		<link>http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/</link>
		<comments>http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 13:47:03 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[AnimateProperties]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[easingFunction]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/</guid>
		<description><![CDATA[<p>The following example shows how you can apply an easing function to a property animation in Flex with the beta Gumbo SDK and Flash Player 10 by setting the easingFunction property on the AnimateProperties object instance.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can apply an easing function to a property animation in Flex with the beta Gumbo SDK and Flash Player 10 by setting the <code>easingFunction</code> property on the AnimateProperties object instance.</p>
<p>Full code after the jump.</p>
<p><span id="more-742"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_test/bin/srcview/source/main1.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/ --&gt;
&lt;Application name="AnimateProperties_easingFunction_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library:adobe/flex/halo"
        layout="flex.layout.BasicLayout"&gt;

    &lt;Declarations&gt;
        &lt;AnimateProperties id="animateProps"
                easingFunction="Elastic.easeOut"
                duration="4000"&gt;
            &lt;propertyValuesList&gt;
                &lt;PropertyValuesHolder property="rotationY"
                        values="[0, 360]" /&gt;
            &lt;/propertyValuesList&gt;
        &lt;/AnimateProperties&gt;
    &lt;/Declarations&gt;

    &lt;Script&gt;
        import mx.effects.easing.*;

        private function animateRotationY():void {
            animateProps.stop();
            animateProps.play([img]);
        }
    &lt;/Script&gt;

    &lt;Button label="Rotate y-axis"
            top="10"
            left="10"
            click="animateRotationY();" /&gt;

    &lt;mx:Image id="img"
            source="@Embed('Fx.png')"
            width="100"
            height="100"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_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/AnimateProperties_easingFunction_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>You can also set the <code>easingFunction</code> property in ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/ --&gt;
&lt;Application name="AnimateProperties_easingFunction_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library:adobe/flex/halo"
        layout="flex.layout.BasicLayout"
        initialize="init();"&gt;

    &lt;Script&gt;
        import flex.effects.AnimateProperties;
        import flex.effects.PropertyValuesHolder;
        import mx.effects.easing.*;

        private var animateProps:AnimateProperties;

        private function init():void {
            var rotYProp:PropertyValuesHolder;
            rotYProp = new PropertyValuesHolder("rotationY", [0, 360]);
            animateProps = new AnimateProperties();
            animateProps.easingFunction = Elastic.easeOut;
            animateProps.duration = 4000; // ms
            animateProps.propertyValuesList = [rotYProp];
        }

        private function animateRotationY():void {
            animateProps.stop();
            animateProps.play([img]);
        }
    &lt;/Script&gt;

    &lt;Button label="Rotate y-axis"
            top="10"
            left="10"
            click="animateRotationY();" /&gt;

    &lt;mx:Image id="img"
            source="@Embed('Fx.png')"
            width="100"
            height="100"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using an easing function with the AnimateProperties class in Flex and Flash Player 10 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/',contentID: 'post-742',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'duration,easingFunction,Gumbo',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/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying a dynamically loaded MP3 file&#8217;s ID3 information in Flex using the SoundEffect class</title>
		<link>http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/</link>
		<comments>http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 06:34:46 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ID3Info]]></category>
		<category><![CDATA[SoundEffect]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[id3]]></category>
		<category><![CDATA[isPlaying]]></category>
		<category><![CDATA[useDuration]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex/">&#8220;Displaying a dynamically loaded MP3 file&#8217;s ID3 information in Flex&#8221;</a>, we saw how to load an MP3 into Flex using the Sound class.</p> <p>The following example shows you how you can dynamically load and play an MP3 in Flex using the SoundEffect class, and access the Sound object and it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex/">&#8220;Displaying a dynamically loaded MP3 file&#8217;s ID3 information in Flex&#8221;</a>, we saw how to load an MP3 into Flex using the Sound class.</p>
<p>The following example shows you how you can dynamically load and play an MP3 in Flex using the SoundEffect class, and access the Sound object and it&#8217;s ID3 information.</p>
<p>Full code after the jump.</p>
<p><span id="more-545"></span></p>
<p class="construction">I didn&#8217;t include all the MP3 files in the source code ZIP. You can download the MP3s from <a href="http://ghosts.nin.com/main/order_options" target="_blank">http://ghosts.nin.com/main/order_options</a>. Hooray for free Nine Inch Nails songs and Creative Commons licensing!</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_sound_id3_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/ --&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.utils.ObjectUtil;

            private const NIN_URL:String = "http://ghosts.nin.com/";

            private function playSoundEffect(src:String):void {
                textArea.text = "";

                if (soundEffect.isPlaying) {
                    soundEffect.stop();
                }
                soundEffect.source = src;
                soundEffect.play([soundEffect]);
            }

            private function soundEffect_id3(evt:Event):void {
                var id3Info:ID3Info = Sound(soundEffect.sound).id3;
                textArea.text += ObjectUtil.toString(id3Info);
                textArea.text += "\\n\\n-------------------\\n\\n";
            }

            private function comboBox_change(evt:Event):void {
                var cb:ComboBox = evt.currentTarget as ComboBox;
                playSoundEffect(cb.selectedItem.@source);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XML id="playlist" source="data/playlist.xml" /&gt;

    &lt;mx:SoundEffect id="soundEffect"
            duration="10000"
            useDuration="true"
            id3="soundEffect_id3(event);" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:ComboBox id="comboBox"
                prompt="Please select a song..."
                dataProvider="{playlist.song}"
                labelField="@title"
                change="comboBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TextArea id="textArea"
            editable="false"
            width="100%"
            height="100%" /&gt;

    &lt;mx:LinkButton id="linkButton"
            label="All songs copyright Nine Inch Nails (2008)"
            click="navigateToURL(new URLRequest(NIN_URL), '_blank');" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_sound_id3_test/playlist.xml">View playlist.xml</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/ --&gt;
&lt;playlist&gt;
    &lt;song title="Track 1" source="assets/01 Ghosts I.mp3" /&gt;
    &lt;song title="Track 2" source="assets/02 Ghosts I.mp3" /&gt;
    &lt;song title="Track 3" source="assets/03 Ghosts I.mp3" /&gt;
    &lt;song title="Track 4" source="assets/04 Ghosts I.mp3" /&gt;
    &lt;song title="Track 5" source="assets/05 Ghosts I.mp3" /&gt;
    &lt;song title="Track 6" source="assets/06 Ghosts I.mp3" /&gt;
    &lt;song title="Track 7" source="assets/07 Ghosts I.mp3" /&gt;
    &lt;song title="Track 8" source="assets/08 Ghosts I.mp3" /&gt;
    &lt;song title="Track 9" source="assets/09 Ghosts I.mp3" /&gt;
&lt;/playlist&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/SoundEffect_sound_id3_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/SoundEffect_sound_id3_test/bin/main.html" width="100%" height="400"></iframe></p>
<p class="note">Note that the SoundEffect only plays the first 10 seconds of each song. If you wanted to play the full song, simply omit the <code>duration</code> property in the &lt;mx:SoundEffect /&gt; tag, and set the <code>useDuration</code> property to <code>false</code>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying a dynamically loaded MP3 file\&#039;s ID3 information in Flex using the SoundEffect class on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/',contentID: 'post-545',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'duration,id3,isPlaying,useDuration',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/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex-using-the-soundeffect-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

