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...
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...
myTrack = new Sound();
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;
poll = setInterval(RockAndRoll, 1000);
Hehe... While I was typing this and researching on the web, hangalot has answered the question already...