Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : Problems with a dynamic text field


waveturtle
5/19/2004 11:44:40 PM
I'm trying to build an mp3 player that uses the id3 tags to inform the listener
about the song info.

I created a function that populates the dynamic text field "track_txt" with
the id3 tag "TIT2" when the song loads.
It works fine for me when I "test Scene" but if I open the swf file in Flash
Player, the first song title does not appear. When I click the next btn it
works fine, but when it first loads it won't work.

Any help is greatly appreciated.
The code I've used is below

Thank you



var musicInfo_lv:LoadVars = new LoadVars();
musicInfo_lv.load("music/musicTotal.txt");
var dosSong:Sound = new Sound();
var curSongNum:Number = 0;

//-----dynamic text box info--------\\
function id3text() {
track_txt.text = dosSong.id3.TIT2;
album_txt.text = dosSong.id3.TALB;
year_txt.text = dosSong.id3.TYER;
}
//-----/dynamic text box info--------\\

//-----go to next song when playing song ends--------\\
dosSong.onSoundComplete = function() {
curSongNum++;
loadSong();
}
//-----/go to next song when playing song ends--------\\

//-----load song from music folder--------\\
function loadSong() {
dosSong.loadSound("music/music" + curSongNum + ".mp3", false);
dosSong.onLoad = function() {
dosSong.start(0,1);
id3text();
}
}
//-----/load song from music folder--------\\

loadSong();

//-----next song btn-----\\
this.nextSong_btn.onRelease = function() {
if (curSongNum < Number(musicInfo_lv.totalSongs)-1) {
curSongNum++;
}
else {
curSongNum = 0;
}
loadSong();
}
//-----/next song btn-----\\

//-----prev song btn------\\
this.prevSong_btn.onRelease = function() {
if (curSongNum == 0) {
curSongNum = Number(musicInfo_lv.totalSongs) - 1;
}
else {
curSongNum--;
}
loadSong();
}
//-----/prev song btn------\\
kglad
5/19/2004 11:50:40 PM
AddThis Social Bookmark Button