动态更改url flash builder

时间:2013-03-21 10:31:56

标签: string flash-builder dynamic-url

我正在尝试为这个单词的每一个创建带有单词和声音列表的应用程序 XML

<bla>
   <list>
         <word>Hello</word>
         <audio>Hello.mp3</audio>
   </list>
   <list>
         <word>Bye</word>
         <audio>bye.mp3</audio>
   </list>
</bla>

消息来源:

<s:navigationContent>
        <s:Button label="Listan" click="playSound();"/>
</s:navigationContent>

脚本:

<fx:Script>
     <![CDATA[
            import flash.media.*;

            [Embed(source="assent/sounds/{data.audio}")]

            [Bindable]
            public var sndCls:Class;
            public var snd:Sound = new sndCls() as Sound; 
            public var sndChannel:SoundChannel;

            public function playSound():void {
                sndChannel=snd.play();
            }   
            public function stopSound():void {
                sndChannel.stop();
            }   
        ]]>
    </fx:Script>

我在这里有错误:

[Embed(source="assent/sounds/{data.audio}")]

错误讯息:

Unable to transcode {data.audio}.

我该怎么做才能解决它:} 使用Flash Builder 4.6

1 个答案:

答案 0 :(得分:0)

Embed =编译器指令。 Embed根本没有任何运行时能力。您必须嵌入所有资产或动态加载它...