<?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; MP3</title>
	<atom:link href="http://blog.flexexamples.com/category/mp3/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 sound effects in your Flex applications</title>
		<link>http://blog.flexexamples.com/2007/08/07/embedding-sound-effects-in-your-flex-applications/</link>
		<comments>http://blog.flexexamples.com/2007/08/07/embedding-sound-effects-in-your-flex-applications/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 05:58:30 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Embed]]></category>
		<category><![CDATA[MP3]]></category>
		<category><![CDATA[SoundAsset]]></category>
		<category><![CDATA[SoundEffect]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/07/embedding-sound-effects-in-your-flex-applications/</guid>
		<description><![CDATA[<p>I was investigating a bug today with embedded sounds over a Remote Desktop Connection and came up with the following code that I thought I&#8217;d share.</p> <p>I tested three different methods of embedding sound effects into a Flex application:<br /> 1) Using the &#60;mx:SoundEffect /&#62; tag, an inline @Embed, and mouseDownEffect<br /> 2) Using the [...]]]></description>
			<content:encoded><![CDATA[<p>I was investigating a bug today with embedded sounds over a Remote Desktop Connection and came up with the following code that I thought I&#8217;d share.</p>
<p>I tested three different methods of embedding sound effects into a Flex application:<br />
1) Using the &lt;mx:SoundEffect /&gt; tag, an inline @Embed, and <code>mouseDownEffect</code><br />
2) Using the [Embed] metadata, &lt;mx:SoundEffect /&gt; with a binding to my embedded asset, and <code>mouseDownEffect</code><br />
3) Using the [Embed] metadata, the SoundAsset class, and the <code>SoundAsset.play()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-65"></span></p>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&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.controls.Alert;

            private var alert:Alert;

            private function showAlert():void {
                alert = Alert.show("Are you sure you want to delete the internet?", "Confirm delete...", Alert.YES | Alert.NO);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:SoundEffect id="soundEffect" source="@Embed(source='assets/ding.mp3')" /&gt;

    &lt;mx:Button label="Delete Internet?" click="showAlert();" mouseDownEffect="{soundEffect}" /&gt;

&lt;/mx:Application&gt;
</pre>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&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.controls.Alert;

            [Bindable]
            [Embed('assets/ding.mp3')]
            private var ding_mp3:Class;

            private var alert:Alert;

            private function showAlert():void {
                alert = Alert.show("Are you sure you want to delete the internet?", "Confirm delete...", Alert.YES | Alert.NO);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:SoundEffect id="soundEffect" source="{ding_mp3}" /&gt;

    &lt;mx:Button label="Delete Internet?" click="showAlert(); " mouseDownEffect="{soundEffect}" /&gt;

&lt;/mx:Application&gt;
</pre>
<pre class="code" lang="actionscript">
&lt;?xml version="1.0" encoding="utf-8"?&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.controls.Alert;
            import mx.core.SoundAsset;

            [Embed('assets/ding.mp3')]
            private var ding_mp3:Class;

            private var ding:SoundAsset = new ding_mp3() as SoundAsset;

            private var alert:Alert;

            private function showAlert():void {
                alert = Alert.show("Are you sure you want to delete the internet?", "Confirm delete...", Alert.YES | Alert.NO);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Button label="Delete Internet?" click="showAlert(); ding.play()" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Embedding sound effects in your Flex applications on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/07/embedding-sound-effects-in-your-flex-applications/',contentID: 'post-65',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: '',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/embedding-sound-effects-in-your-flex-applications/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

