EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 601

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
About loading and using external MP3 files 601
You can find a sample source file that loads MP3 files, jukebox.fla, in the Samples folder on
your hard disk. This sample demonstrates how to create a jukebox by using data types, general
coding principles, and several components.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\Components\Jukebox.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/Components/Jukebox.
Reading ID3 tags in MP3 files
ID3 tags are data fields that are added to an MP3 file. ID3 tags contain information about the
file, such as the name of a song, album, and artist.
To read ID3 tags from an MP3 file, use the
Sound.id3 property, whose properties correspond
to the names of ID3 tags included in the MP3 file that you load. To determine when ID3 tags
for a downloading MP3 file are available, use the
Sound.onID3 event handler. Flash Player 7
supports version 1.0, 1.1, 2.3, and 2.4 tags; version 2.2 tags are not supported.
The following example loads an MP3 file named song1.mp3 into the
song_sound Sound
object. When the ID3 tags for the file are available, the
display_txt text field shows the
artist name and song name.
To read ID3 tags from an MP3 file:
1. Create a new FLA file called id3.fla.
2. Select Frame 1 on the Timeline and type the following code in the Actions panel:
this.createTextField("display_txt", this.getNextHighestDepth(), 0, 0,
100, 100);
display_txt.autoSize = "left";
display_txt.multiline = true;
var song_sound:Sound = new Sound();
song_sound.onLoad = function() {
song_sound.start();
};
song_sound.onID3 = function():Void {
display_txt.text += "Artist:\t" + song_sound.id3.artist + "\n";
display_txt.text += "Song:\t" + song_sound.id3.songname + "\n";
};
song_sound.loadSound("http://www.helpexamples.com/flash/sound/
song1.mp3");
3.
Select Control > Test Movie to test the sound.
The ID3 tags appear on the Stage, and the sound plays.

Table of Contents

Related product manuals