If statement not recognized?

so i have this code for a video player i’m using


var listenerObject:Object = new Object();
listenerObject.stateChange = function(eventObject:Object):Void  {
    if (eventObject.state == "buffering") {
    }
    if (eventObject.state == "playing") {
    }
    if (eventObject.state == "rewinding") {
    }
    if (eventObject.state == "paused") {
    }

};
myPlayer.volume = 100;
myPlayer.addEventListener("stateChange",listenerObject);

//myPlayer.contentPath=currentVideo;
myPlayer.bufferTime = 5;

_root.debug("PLAYING: "+currentVideo);

stop();

mTimer._visible = false;
setInterval(updateTime,500);
function updateTime() {
    cTime = formatTime(myPlayer.playheadTime);
    tTime = formatTime(myPlayer.totalTime);
    //trace("playhead time"+cTime);
    //trace("Total time" + formatTime(myPlayer.totalTime));
    if (cTime>5) {
        trace("TRUE");
        curtain.btnHandler();
    }
    if (myPlayer.totalTime>0) {// video must be loaded
        mTimer._visible = true;
    }
}

function formatTime(wTime) {
    fTime = "";
    if (!isNaN(wTime)) {
        mins = Math.floor(wTime/60);
        secs = Math.floor(wTime-(mins*60));
        fTime = addZero(mins)+":"+addZero(secs);
    }
    return fTime;
}

function addZero(wNum) {
    rNum = wNum;
    if (wNum<10) {
        rNum = "0"+wNum;
    }
    return rNum;
}

Everything works really well, i just want the if statment that says:


if (cTime>5) {
        trace("TRUE");
        curtain.btnHandler();
    }

to work and i can’t figure out why its not???

Thanks again for the help i get here.

maybe try using an else statement in there as well as trace the amount of cTime variable

if (cTime>5) {
        trace("TRUE");
        curtain.btnHandler();
    }else{
trace(cTime)};

for some reason its going right to the else, even the the time on the video is greater than 5 seconds??

I’m perplexed?

declare

var cTime:Number = 20;myPlayer.volume = 100;

on the first line above “my player” and test it out I have a theory

unfortunately, it didn’t do anything? your theory was?
I’m starting to think it has to do with the format of the time, its not recognizing it as real numbers so my if statement doesn’t make any sense to it???

yes, if i set a variable:
playTime = myPlayer.playheadTime;
then it will recognize it, it was the formating that screwed things up

^congrats