2 Replies Latest reply on Feb 14, 2011 10:59 AM by Lady Lilly

    Burrito - problem with embedding sounds (source from XML)

    Lady Lilly




      I’m trying to build Dictionary in Burrito. And I have problem with embedding sounds.


      I’m working with XML. Here’s example of my XML data:



      <?xml version="1.0" encoding="utf-8"?>












                      <pol>Dzień dobry. (rano)</pol>














                      <pol>Dzień dobry. (po południu)</pol>










      I have (of course in an interesting part of project) two files: First.mxml and PhraseDetails.mxml:



      <?xml version="1.0" encoding="utf-8"?>


      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"


                  xmlns:s="library://ns.adobe.com/flex/spark" title="First" creationComplete="srv.send()">






                  <s:HTTPService id="srv" url="phr/first.xml"/>



            <s:List id="list" top="0" bottom="0" left="0" right="0"


                        change="navigator.pushView(PhraseDetails, list.selectedItem)">




                              <s:MobileIconItemRenderer label="{data.pol}" messageField="kan"/>


                        </fx:Component> </s:itemRenderer>





                  <s:Button icon="@Embed('img/h.png')" click="navigator.popView()"/>








      <?xml version="1.0" encoding="utf-8"?>

      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"


                  title="Phrase Details">





                        import flash.net.*;

                        import mx.events.*;


                        public var link:URLRequest = new URLRequest("phr/sou/1.mp3");

                        public var sound:Sound = new Sound(link);








            <s:HGroup verticalAlign="middle">



                        <s:Label text="kanji:"/>

                        <s:Label text="{data.kan}"/>


                        <s:Label text="romanaji:"/>

                        <s:Label text="{data.rom}"/>


                        <s:Label text="polski:"/>

                        <s:Label text="{data.pol}"/>

                        <s:Button  label="dźwięk" click="sound.play();" />






                  <s:Button icon="@Embed('img/h.png')" click="navigator.popView()"/>






      In first View of application I have list of phrases. When we choose the phrase, we go to her details. All text displays good. But I have problem with sounds. When I write the exact path (public var link:URLRequest = new URLRequest("phr/sou/1.mp3");)all is OK. But I must write source from XML. And I don’t have any idea. I’m trying write sounds just as text in Label, but {data.source} don’t work in <![CDATA[ … ]]> I’m trying write some function, but unsuccessfully.


      I'll be thankful for any suggest.