That is because you are executing the code one right after another. I'm surprised that it ever gets as high as 1.
You need to put the first date right after you execute the load command, which is what you have.
But you need to put the second trace inside the COMPLETE event handling function. Which I see you have assigned, but I don't see where the LoadXML function is called. BTW, it is generally good to start Class names with capital letters, but methods (functions) should start with lower case letters.
I think you can also make it a little easier if you use getTimer() instead of the Date class.
loadTimeTB.text = "Loaded : "+ (getTimer()-startTime) +" Milliseconds";
thanks for bringing up new things in actionscript.
but im still confuse with actionscript syntax.
here's my full syntax, i just compiled it, still with errors. can you help me which part that I mistaken?
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
var dp:DataProvider = new DataProvider();
xmlData = new XML(e.target.data);
var dp:DataProvider = new DataProvider(xmlData);
myDataList.dataProvider = dp;
myDataList.horizontalScrollPolicy = ScrollPolicy.ON;
loadTimeTB.text = "Loaded : "+ ( getTimer() - startTimer ) +" Milliseconds";
loadTimeTB.autoSize = TextFieldAutoSize.LEFT;
thanks for your time to responding me.
1 person found this helpful
use the urlloader's progress event to repeatedly update the load duration. using getTimer() would be more efficient and as informative as using the date class, in this situation.
i dunno why, accidently works.
bunch a thanks you guys for helpin me trough!
if that works, it's because you're testing locally or your xml file is small.