actionscript 3 - Is there a difference between MovieClip(X) and X as Movieclip? -
this question has answer here:
- as3: cast or “as”? 8 answers
maybe in performance.
i'm using movieclip(getchildbyname("x")).stop();
better (getchildbyname("x") movieclip).stop(); ?
results: (ui.getchildat(0) spectrumanalyzer) = 174 ms spectrumanalyzer(ui.getchildat(0)) = 200 ms
for programmer it's same - don't know if code doing same thing in 2 different ways. anyways difference 26 ms 1 mio iterations.
var sa:spectrumanalyzer = new spectrumanalyzer() var ui:uicomponent = new uicomponent() ui.addchild(sa) addelement(ui) var start:number = new date().gettime() for(var i:int=0; i<1000000; i++){ (ui.getchildat(0) spectrumanalyzer) } var end:number = new date().gettime() trace(end-start) start = new date().gettime() for(var i:int=0; i<1000000; i++){ spectrumanalyzer(ui.getchildat(0)) } end = new date().gettime() trace(end-start)
Comments
Post a Comment