03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

The following example displays the ID3 properties of song1.mp3 to an instance of the<br />

DataGrid component. Add a DataGrid with the instance name id3_dg to your document,<br />

<strong>and</strong> add the following ActionScript to your FLA or AS file:<br />

import mx.controls.gridclasses.DataGridColumn;<br />

var id3_dg:mx.controls.DataGrid;<br />

id3_dg.move(0, 0);<br />

id3_dg.setSize(Stage.width, Stage.height);<br />

var property_dgc:DataGridColumn = id3_dg.addColumn(new<br />

DataGridColumn("property"));<br />

property_dgc.width = 100;<br />

property_dgc.headerText = "ID3 Property";<br />

var value_dgc:DataGridColumn = id3_dg.addColumn(new<br />

DataGridColumn("value"));<br />

value_dgc.width = id3_dg._width-property_dgc.width;<br />

value_dgc.headerText = "ID3 Value";<br />

var my_sound:Sound = new Sound();<br />

my_sound.onID3 = function() {<br />

trace("onID3 called at "+getTimer()+" ms.");<br />

for (var prop in this.id3) {<br />

id3_dg.addItem({property:prop, value:this.id3[prop]});<br />

}<br />

};<br />

my_sound.loadSound("song1.mp3", true);<br />

See also<br />

attachSound (Sound.attachSound method), id3 (Sound.id3 property), loadSound<br />

(Sound.loadSound method)<br />

onLoad (Sound.onLoad h<strong>and</strong>ler)<br />

onLoad = function(success:Boolean) {}<br />

Invoked automatically when a sound loads. You must create a function that executes when the<br />

this h<strong>and</strong>ler is invoked. You can use either an anonymous function or a named function (for<br />

an example of each, see Sound.onSoundComplete). You should define this h<strong>and</strong>ler before you<br />

call mySound.loadSound().<br />

Parameters<br />

success:Boolean - A Boolean value of true if my_sound is loaded successfully, false<br />

otherwise.<br />

Sound 577

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!