Quantcast
Channel: Adobe Community : Discussion List - Using Flash Builder
Viewing all articles
Browse latest Browse all 1802

How to import and play sound file from mxl link?

$
0
0

I need to load different sound files dependent on which link you previously clicked in my app, but cannot figure out how to call the link to the sound file from my mxl file:

 

<carRace>http://www.unisux.org/zik-car/lamborghini-diablo-gtr_standing-start.mp 3</carRace>

 

Can someone tell me what I am doing wrong in this code?

 

<fx:Script>

   <![CDATA[

                                        privatevar req:URLRequest;

                                        privatevar context:SoundLoaderContext = new SoundLoaderContext(1000);

                                        privatevar bCall:Sound;

                                        privatevar bSong:Sound;

 

  privatefunction playSong():void

                                        {

                                                  var urlSong:String = "{carRace}";

                                                  var request:URLRequest = new URLRequest(urlSong);

                                                  bSong = new Sound(request, context);

                                                  bSong.play();

                                        }

  ]]>

</fx:Script>

 

 

because this code does work:

 

<fx:Script>

   <![CDATA[

  privatevar req:URLRequest;

  privatevar context:SoundLoaderContext = new SoundLoaderContext(1000);

  privatevar bCall:Sound;

  privatevar bSong:Sound;

 

  privatefunction playSong():void

                                        {

  var urlSong:String = "http://www.unisux.org/zik-car/lamborghini-diablo-gtr_standing-start.mp 3";

                                                  var request:URLRequest = new URLRequest(urlSong);

                                                  bSong = new Sound(request, context);

                                                  bSong.play();

 

}

  ]]>

</fx:Script>


Viewing all articles
Browse latest Browse all 1802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>