xml version encoding utf-8 mx Application xmlns mx http www adobe com

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()">
<mx:Text id="load" text=""/>
<mx:Script>
<![CDATA[
import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
private var s:Sound;
public function initApp():void {
s = new Sound();
var req:URLRequest = new URLRequest("http://muzx.net/files/mmp/2/Alt anesis feat mike a - radiant ablaze.mp3");
s.addEventListener(ProgressEvent.PROGRESS, playSound);
s.load(req);
}
public function playSound(event:ProgressEvent):void {
var loadedPct:uint = Math.round(100 * (event.bytesLoaded / event.bytesTotal));
var localSound:Sound = event.target as Sound;
load.text = "Loaded " + loadedPct + "%";
if(loadedPct==10) {
localSound.play();
}
}
public function onSoundLoaded(event:Event):void {
var localSound:Sound = event.target as Sound;
localSound.play();
}
]]>
</mx:Script>
</mx:Application>