【发布时间】:2012-01-16 09:23:42
【问题描述】:
我有一个嵌入在带有开始和停止按钮的 Flex 应用程序中的 mp3。使用此代码...
<fx:Script>
<![CDATA[
import mx.core.SoundAsset;
import flash.media.*;
[Embed(source="assets/pie-yan-knee.mp3")]
[Bindable]
public var Song:Class;
public var mySong:SoundAsset = new Song() as SoundAsset;
public var channel:SoundChannel;
public function playSound():void
{
stopSound();
channel = mySong.play();
}
public function stopSound():void
{
if ( channel != null ) channel.stop();
}
]]>
</fx:Script>
<s:HGroup>
<s:Button label="play" click="playSound();"/> <s:Button label="stop"
click="stopSound();"/>
</s:HGroup>
不过,我希望有多个具有不同声音的实例。 我该怎么做?
【问题讨论】:
标签: actionscript-3 apache-flex embed flex4.5 audio