How to display elapsed/current time of a song in Actionscript.
Hi I have a question on how I can make my code display a total time for a song from a media player I created with Actionscript 3.0, using XML to load the song track.
This is my current function which I have done and I am unsure on what the problem is that is not allowing the elapsed time to display in a textfield on my stage.
stage.addEventListener(Event.ENTER_FRAME, timeElapsed);
function timeElapsed(e:Event):void
{
var minutesCurr:Number = Math.floor((my_channel.position /1000) /60);
var secondsCurr = Math.floor((my_channel.position /1000) % 60);
if (secondsCurr < 10)
{
secondsCurr = "0" + secondsCurr;
}
var minutesTot:Number = Math.floor((my_sound.length /1000) /60);
var secondsTot = Math.floor((my_sound.length /1000) % 60);
if (secondsTot < 10)
{
secondsTot = "0" + secondsTot;
}
completeText_txt.text = minutesCurr + ":" + secondsCurr + "/" + minutesTot + ":" + secondsTot;
}
I tried adding to the stage and I am getting a null object reference.
Thanks Casey
