Flash Vista - Home
Newest Cool Site
The Two Tales
Site info | Archive
Main Navigation
Home
New Links
Top Rated
Most Popular
Cool Sites
Search

Flash Tutorials
Flash Resources
Flash News
Flash Templates
Flash Intro Templates
Website Templates
Flash Games
Flash Books
FlashVista Polls
Sitemap


Random Link
English
Deluxe Inc
Site info | Get another
FlashVista
Login
Register
Subscribe

Add Link
Modify Link
Favorites
Suggest Category

Advertise with us
Support us
Credits / Thanks
Contact

Flash Templates:

More Templates ...

Mailing List
User

Password



Register
Forgot password?
Partner websites
iPhone cases and accessories
Free Seo Tools
Free Tutorials
Free Video Tutorials
Best Free Scripts
Wii Fit
Wii Fit News
Other Resources
Suggest
Suggest this site to a friend


Mailing List
Status: Not logged in

English English German French Spanish Italian Portuguese Russian Polish Finnish Dutch Swedish Thai Romanian Traditional Chinese Simplified Chinese
SearchNot logged in
Keyword: Search for: Advanced Search


Accessing ID3 Tags (external .mp3)


NEW Flash Tutorials in Video Format - Powered by LearnFlash.com: 45 minutes of flash tutorials now available in streaming format or download. Topics Include flash for beginners, text effects, actionscripting, audio/video, flash 8 and more.


Printer version



by Guy Watson
www.flashguru.co.uk

In Flash MX you have the capability to load an external mp3 sound file into a flash movie using the Sound.loadSound() method. In the latest release of the Flash 6 Player it is possible to access the ID3 tags embedded in an mp3 encoded file. Unfortuneatley you cannot access the ID3 tags in an mp3 file until it has *fully* loaded, this is fine when you are using the Sound.attachSound() method but it causes problems when you are loading an external sound into the player...

When an external sound has fully loaded into the player, you have to wait one frame before you can retrieve the values of the ID3 tags in the mp3. This means that you cannot access the ID3 tags inside of the Sound objects onLoad event handler. Here is some code that demonstrates how to access the ID3 tags from an external mp3 file loaded into the player using the Sound.loadSound() method:


//create an onEnterFrame event with
//listener capabilities
ASBroadcaster.initialize(Movieclip);
_root.createEmptyMovieClip("__enterFrame",-9799);
__enterFrame.onEnterFrame=function(){
Movieclip.broadcastMessage("onEnterFrame");
}
mysound=new Sound(this);
mysound.loadSound("an_mp3.mp3");
mysound.onLoad=function(){
Movieclip.addListener(this);
//redefine the onLoad event handler
this.onLoad=function(){
//iterate over all the id3 tags
//and trace their names and values
for(var i in this.id3){
trace(i+":"+this.id3[i]);
}
}
//when the onEnterFrame broadcast
//is recieved, call the newly defined
//onLoad evet handler and then
//stop listening to the broadcast
this.onEnterFrame=function(){
this.onLoad();
Movieclip.removeListener(this);
delete this.onEnterFrame;
}
}


The same is true, for two other properties of the sound object, Sound.duration and Sound.position, you cannot access these properties until one frame after an external sound file has fully loaded, you can use the same process outlined above to retrieve the value of these two properties.


(Added: 02-02-2004, Hits: 0, Rating: 3.78, Votes: 18, Reviews: 3)
Add to Favorites Suggest to a Friend

Reviews: (3)

NICE
(Added: 10-09-2006 User: Guest)

do you know more good stuf?

(Added: 10-03-2006 User: Guest)

Wow, thanks Guy, we learn something new everyday ;)

5 stars tutorial :D

And now I have something new to play around lol

(Added: 10-26-2004 User: Thy )


Add Review
Please note:
We review EVERY comment before it appears on the site, so please dont waste your time by posting spam links :)
No URLs allowed, no HTML please.

If you register or login first, your review will contain your nickname


Rate It



Excellent!
Very Good
Good
Fair
Poor