files that use the mp3 format can contain additional data about
the sound in the form of ID3 tags.
Not every mp3 file contains ID3 metadata. When a Sound object
loads an mp3 sound file, it dispatches an
if the sound file contains ID3 metadata. To prevent run-time errors,
your application should wait to receive the
before accessing the
property for a loaded sound.
The following code shows how to recognize when the ID3 metadata
for a sound file has been loaded:
var s = new air.Sound();
var urlReq = new air.URLRequest("mySound.mp3");
var id3 = event.target.id3;
air.trace("Received ID3 Info:");
for (propName in id3)
air.trace(propName + " = " + id3[propName]);
This code starts by creating a Sound object and telling it to
listen for the
event. When the sound file’s
ID3 metadata is loaded, the
is called. The target of the Event object that is passed to the
is the original Sound object. The method then gets the Sound object’s
and iterates through its named properties to trace their values.