0

How do I add another dynamic text field that gives the time stamp when the new file is loaded? in real time not milliseconds?

I have a Adobe Air desktop App built in Flash CS5 App loads a text file into a dynamic text field from the web when file is new and notify's user when new file is loaded.

this is code I have

NativeApplication.nativeApplication.startAtLogin=true

stage.nativeWindow.alwaysInFront=true;

//external text file load and recheck every 2 minutes

var myInterval:uint  = setInterval (loadUrl, 120000);
var loader:URLLoader = new URLLoader(newURLRequest("https://my_text_file.txt"));
loader.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void {
var loadedText:URLLoader = URLLoader(event.target);
if(myText_txt.htmlText!=loadedText.data){
   myText_txt.htmlText = loadedText.data;
     stage.nativeWindow.notifyUser(NotificationType.CRITICAL) 
}else {
  //do nothing
}
}

function loadUrl():void {
    loader = new URLLoader(new URLRequest("https://my_text_file.txt"));
loader.addEventListener(Event.COMPLETE, completeHandler);
   }

 // button control


Minimize_BTN.addEventListener(MouseEvent.CLICK, minimize);
function minimize(e:MouseEvent){
stage.nativeWindow.minimize();

}

drag_BTN.addEventListener(MouseEvent.MOUSE_DOWN, drag);
function drag(e:MouseEvent){
stage.nativeWindow.startMove();

}

stop(); //Stop on the frame you want
  • What is the time stamp supposed to represent? Do you want the current time or something else? – puggsoy Feb 20 '13 at 21:49
  • Create a new `Date` object in completeHandler and format it as you please, then you can display it in your `TextField`. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html – Gio Feb 21 '13 at 07:04
  • I want it to display the time the text has been loaded, when it fires the NotificationType.CRITICAL – Brian Haugen Feb 21 '13 at 20:39

0 Answers0