Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash Mp3 player shows NaN:NaN before counter starts.

Status
Not open for further replies.

ColonelBlue

Technical User
Jun 24, 2004
110
US
Hello I have flash Mp3 player that displays the accumulated minutes and seconds of the song playing. But before a song starts ,when the flash file is first loaded, the counter shows up as NaN:NaN.

I placed an if statement to check if the secs are less than 0, if so then make the counter 00:00. It worked but stayed there even after the song begins.

Please help.
The counter is in a symbol and is in an onEnterFrame function.

Thanks in advance!
 
Code:
onEnterFrame = function () {
		timeInSec = _root.myMusic02.position/1000;
		mins = Math.floor(timeInSec/60);
		// find number of minutes
		secs = Math.floor(timeInSec%60);
		// find remaining seconds
		// add leading zero for single digit values
		mins = (mins<10) ? "0"+mins : mins;
		secs = (secs<10) ? "0"+secs : secs;
		// dynamic txt displays min+sec
		_root.time1.timeText02 = (mins+":"+secs);
		// my_sound on complete
		_root.my_sound.onSoundComplete = function() {
			stopAllSounds();
		}
		}
 
Looks to me like you need to make sure that _root.myMusic02.position is a number and not undefined.
 
dcushnie, thanks for your reply.
Could you please be more specific.
I'm just a little over novice here.
 
hmm about this line:

Code:
_root.time1.timeText02 = (mins+":"+secs);

do you have a textbox with the instance name "timeText02" or is this a var assigned to a textbox?

if its a var then try removing the parenthesis

Code:
_root.time1.timeText02 = mins+":"+secs;

if its a an instance name then add the .text


Code:
_root.time1.timeText02.text = (mins+":"+secs);
 
sorry remove the parenthesis again:

if its a an instance name then add the .text


Code:
_root.time1.timeText02.text = mins+":"+secs;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top