I am creating a score board in flash, am fetching data from REST endpoints. Am able to read data once properly , after that same data repeating not able to read the update data. I tried with timer , could any one help me here
Thanks in advance
my code below
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.text.TextField;
import flash.display.Graphics;
var white: Array = new Array();
var black: Array = new Array();
var red;
var striker;
var myTimer:Timer = new Timer(4000,100);
myTimer.addEventListener(TimerEvent.TIMER, timerListener);
function timerListener (e:TimerEvent):void{
trace("Timer is Triggered");
var urlLoader: URLLoader=null;
// load the JSON data from the URL
urlLoader = new URLLoader(new URLRequest("xxxxxxxxxxx"));
urlLoader.addEventListener(Event.COMPLETE, loadData);
// handle the load completion
function loadData(e: Event):void {
trace(e.target.data);
}
myTimer.start();
stop();
Although I'm not sure what exactly is wrong with your code, there are things I wouldn't use in the project:
With all that in mind the following should work fine: