<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/03/05/displaying-a-dynamically-loaded-mp3-files-id3-information-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
		layout="vertical"
		verticalAlign="middle"
		backgroundColor="white" viewSourceURL="srcview/index.html">

	<mx:Script>
		<![CDATA[
			import mx.utils.ObjectUtil;

			private const URL:String = "http://www.helpexamples.com/flash/sound/song2.mp3";
			private var sound:Sound;
			private var soundLoaderContext:SoundLoaderContext;

			private function loadSound(url:String):void {
				var urlRequest:URLRequest = new URLRequest(url);
				// Check policy file
				soundLoaderContext = new SoundLoaderContext(1000, true);

				sound = new Sound();
				sound.addEventListener(Event.ID3, sound_id3);
				sound.load(urlRequest, soundLoaderContext);
				
				textArea.text = "";
			}

			private function sound_id3(evt:Event):void {
				var id3Info:ID3Info = Sound(evt.currentTarget).id3 as ID3Info;
				textArea.text += ObjectUtil.toString(id3Info);
				textArea.text += "\n---------- ---------- ----------\n";
			}
		]]>
	</mx:Script>

	<mx:ApplicationControlBar dock="true">
		<mx:Button id="button"
				label="Load MP3"
				click="loadSound(URL);" />
	</mx:ApplicationControlBar>

	<mx:TextArea id="textArea"
			editable="false"
			width="100%"
			height="100%" />

</mx:Application>

