Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Flashbuilder 4,桌面空气应用程序-嵌入和播放声音_Actionscript 3_Flash_Apache Flex_Audio_Flash Builder - Fatal编程技术网

Actionscript 3 Flashbuilder 4,桌面空气应用程序-嵌入和播放声音

Actionscript 3 Flashbuilder 4,桌面空气应用程序-嵌入和播放声音,actionscript-3,flash,apache-flex,audio,flash-builder,Actionscript 3,Flash,Apache Flex,Audio,Flash Builder,我是Flashbuilder的新手,我需要学习如何1.)嵌入声音文件(mp3)和2.)能够播放所述文件 我用谷歌查了一下,所有的例子似乎都是针对AS3的,我试着按照下面的方式对它进行修改,但无法让它播放(或者我应该说我什么都听不见?) bgmusic在src级别导入 Test.mxml: <?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml

我是Flashbuilder的新手,我需要学习如何1.)嵌入声音文件(mp3)和2.)能够播放所述文件

我用谷歌查了一下,所有的例子似乎都是针对AS3的,我试着按照下面的方式对它进行修改,但无法让它播放(或者我应该说我什么都听不见?)

bgmusic在src级别导入

Test.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import flash.media.Sound;


            [Embed(source="bgmusic.mp3")]
            public var mySound:Class;

            protected function button1_clickHandler(event:MouseEvent):void
            {

                var s:Sound = new mySound() as Sound;
                s.play();

            }

        ]]>
    </fx:Script>
    <s:Button label="Test" click="button1_clickHandler(event)" />
</s:WindowedApplication>


您尝试过evolve的singleton库吗?你的代码应该可以工作。对我来说是的。您确定嵌入的源路径正确吗?(如果不是的话应该给出一个错误)愚蠢的问题:但是你点击按钮了吗?