|
Extract and view .mp3 file details - Name of the song, Album, and Artist ID3 tags are data fields added to MP3 file, which contains information such as the name of a song, album, and artist of MP3 files. We will use 'Sound.id3' property to extract these information. In our script, we shall, - Write code to create text field at runtime
- Create a sound object and attach external mp3 file to it
- Extract ID3 tags data (if it exists in the MP3 file), that is 'Name of the song', 'Album' and 'Artist' of the mp3 file and allot to the text field created.
Follow the steps below to achieve our goal, - Create a fla file called 'id3.fla'
- Select 'Frame1' and paste the below code in the 'Action' window
this.createTextField("display_txt", 10, 85, 50, 300, 100); display_txt.autoSize = "left"; //display_txt.textColor = 0xFFFFFF; 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.imajine.in/tutorials/flash/sound2.mp3"); |
- Press 'Ctrl' + 'Enter' to view ID3 Tags if it exists in the mp3 file.
Tags: Display song details, Display name of the song, Album and artist, id3 tags,
Load external MP3 file into flash, Preload MP3 File, play mp3 file, Sound Object
in Flash, Preload and play music, music play and stop button, Volume control, Sound
control
|