Monday, April 29, 2019

actionscript 3 - How to get a time as a variable in Flash CS6

I am trying to get a time that is in a text document to become a variable in a Flash CS6 AS3 project. I can't seem to find where the problem is and the error messages aren't really helping. The highlighted parts are the changed lines.




Here is the newest code:




this.onEnterFrame = function()



{



var StartTime:URLLoader = new URLLoader();




StartTime.dataFormat=URLLoaderDataFormat.VARIABLES;



StartTime.addEventListener(Event.COMPLETE, onLoaded);



function onLoaded(e:Event):void {



}



StartTime.load(new URLRequest("ResponseTime.txt"));




var today:Date = new Date();



var currentTime = today.getTime();



var targetDate:Date = new Date();



var timeLeft = e.data - currentTime;



var sec = Math.floor(timeLeft/1000);




var min = Math.floor(sec/60);



sec = String(sec % 60);



if(sec.length < 2){



sec = "0" + sec;



}




min = String(min % 60);



if(min.length < 2){



min = "0" + min;



}



if(timeLeft > 0 ){




var counter:String = min + ":" + sec;



time_txt.text = counter;



}else{



    var newTime:String = "00:00";

time_txt.text = newTime;


delete (this.onEnterFrame);


}



}




Newest Error:





1120: Access of undefined property e. (Line 17).


No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...