Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-28-2003, 09:58 AM   #1
ekstrak
Registered User
 
Join Date: Feb 2003
Location: london, UK
Posts: 9
Default mp3 length request

hi.

does anyone know if it is possible for MX to ask an mp3 file how long it is ?

thats it..

thanks in advance.

rob :ekstrak:
ekstrak is offline   Reply With Quote
Old 02-28-2003, 10:25 AM   #2
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,858
Default

sjoe! this is a difficult one. but after having consulted the HELP FILES associated with flash i discovered this property on the sound object

Quote:
Sound.duration

Availability


Flash Player 6.

Usage


mySound.duration

Description


Property (read-only); the duration of a sound in milliseconds.
and here i was going 2 sugest working it out....eeeeccchhh!

__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 02-28-2003, 10:29 AM   #3
ekstrak
Registered User
 
Join Date: Feb 2003
Location: london, UK
Posts: 9
Default

got it... thanks mate.. sorry, i've only just got MX and so am not entirely familiar with all the new commands. it just didnt occur to me to look in the library.. thanks for the help, much appreciated.
ekstrak is offline   Reply With Quote
Old 02-28-2003, 10:36 AM   #4
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,858
Default

kewl

lol

__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 02-28-2003, 10:56 AM   #5
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Howdy... Welcome aboard...

I personally don't know how to detect the length of the MP3 file... So, I did some googling and found this...

This is the article, Flash MX Turntable Launched, by Todd Dominey...
and it says...
Quote:
Neither the Flash 4 nor 5 player could detect the length of an audio clip. As a result, it was practically impossible to control animations or effects based on when an audio clip ended. Because of the limitation, the original turntable played mp3s of equal length - 90 seconds. The needle arm then rotated the appropriate amount to create a believable illusion. But, admittedly, it was a hack. Finally with Flash MX the needle arm detects the length of the mp3, and rotates across the face of the record in perfect time. For extra realism, ...
I don't know how he did, but maybe you can ask him how he did that and let us know???


Too soon to say that...

Hm... It seems like you can use Sound.duration property to know the length of the MP3 file... Dang... I should have checked the Flash manual first...

Try this...(Copied from the Flash Release Note...) Create a text field, tf, and load your MP3 file to see the duration and ID3 information...
ActionScript Code:
myTrack = new Sound(); function RockAndRoll() {     myTrack.start();     if ((myTrack.getBytesLoaded() == myTrack.getBytesTotal()) && myTrack.duration > 0)     {         tf.text += "songName = " + myTrack.id3.songname + "." + newline;         tf.text += "Artist = " + myTrack.id3.artist + "." + newline;         tf.text += "album = " + myTrack.id3.album + newline;         tf.text += "year = " + myTrack.id3.year + newline;         tf.text += "comment = " + myTrack.id3.comment + newline;         tf.text += "track = " + myTrack.id3.track + newline;         tf.text += "genre = " + myTrack.id3.genre + newline;         tf.text += "duration = " + myTrack.duration;         clearInterval(poll);     } } myTrack.loadSound("MP3ID3.mp3", false); poll = setInterval(RockAndRoll, 1000);
Hehe... While I was typing this and researching on the web, hangalot has answered the question already...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-28-2003, 11:06 AM   #6
ekstrak
Registered User
 
Join Date: Feb 2003
Location: london, UK
Posts: 9
Default

gutted.. thanks alot though mate... good of you to take the time.
ekstrak is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:51 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.