Flex Demo 8 - Streaming External Sound

View Flex Demo 8

This sample demonstrates streaming an external sound file from within a Flex application.

This file uses an 'applicationComplete' handler to initiate a bit of ActionScript that loads the external sound file and plays it.
<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
               applicationComplete="appCompleteInit()" viewSourceURL="srcview_fbdemo_8/index.html"> 
    <fx:Script> 
        <![CDATA[        
            import flash.media.Sound;
            import flash.net.URLRequest;
            
            protected function appCompleteInit():void { 
                var s:Sound = new Sound();
                var req:URLRequest = new URLRequest("http://jimhalliday.net/local/flex/helix_e.mp3");
                s.load(req);
                s.play(0, 9999);     
            } 
        ]]> 
    </fx:Script> 
    <fx:Declarations> 
        <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 
    <s:Label x="20" y="18" text="Currently streaming Do Androids Dream?" width="474" height="30" fontSize="22"/> 
    <s:Label x="27" y="52" text="by Helix Eternal (www.helixeternal.com)" width="385" height="31" fontSize="22"/> 
</s:Application>