Revision: 16670
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 12, 2009 02:14 by ericfickes
Initial Code
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" borderColor="#010101" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#000000, #020202]" width="150" height="150" horizontalAlign="center" verticalAlign="middle"> <mx:Script> <![CDATA[ import mx.core.SoundAsset; import flash.media.*; [Embed(source="../sounds/fart1.mp3")] [Bindable] public var fart1:Class; [Embed(source="../sounds/fart2.mp3")] [Bindable] public var fart2:Class; [Embed(source="../sounds/fart3.mp3")] [Bindable] public var fart3:Class; [Embed(source="../sounds/fart4.mp3")] [Bindable] public var fart4:Class; [Embed(source="../sounds/fart5.mp3")] [Bindable] public var fart5:Class; public var myFart1:SoundAsset = new fart1() as SoundAsset; public var myFart2:SoundAsset = new fart2() as SoundAsset; public var myFart3:SoundAsset = new fart3() as SoundAsset; public var myFart4:SoundAsset = new fart4() as SoundAsset; public var myFart5:SoundAsset = new fart5() as SoundAsset; public var channel:SoundChannel; //index of currently playing sound private var idx:int = 0; //max number of embedded sound files private var iSoundCt:int = 4; //HACK : use zero indexing for access in fart() //sounds collection private var aSounds:Array = new Array( myFart1, myFart2, myFart3, myFart4, myFart5 ); //temp ref to sound private var tmpSound:SoundAsset; //play sound public function fart():void { // Make sure we don't get multiple songs playing at the same time stopSound(); //get reference to sound tmpSound = aSounds[ idx ]; // Play the song on the channel channel = tmpSound.play(); //increment or reset index if( idx == iSoundCt ) { idx = 0; } else { idx++; } } public function stopSound():void { // Stop the channel, but only if it exists if ( channel != null ) channel.stop(); tmpSound = null; } ]]> </mx:Script> <mx:Image id="img_air" source="@Embed('../images/air_flex_small.jpg')" autoLoad="true" scaleContent="true" click="fart()" mouseOver="fart()" /> </mx:WindowedApplication>
Initial URL
http://www.ifartair.com
Initial Description
Here is the MXML source code for a simple FLEX based soundboard. You can download this Adobe AIR application at http://www.ifartair.com/
Initial Title
Sourcecode for ifartair.com AIR / Flex soundboard
Initial Tags
class, Flex
Initial Language
MXML