코드 실행에 걸리는 평균 시간과 각 프레임이 Flex 어플리케이션에서 렌더링되는 데 걸리는 시간을 측정하는 방법이 있습니까? 좀 더 구체적으로 말하면, getTimer()를 사용하는 방법을 알고 있지만 이것을 수행하기 위해 어떤 이벤트를 청취해야하는지 잘 모르겠습니다. this post을 읽었을 때 실제 렌더링이 얼마나 오래 걸리는지 알 수없는 방법입니다 (렌더러 이벤트 발생과 다음 ENTER_FRAME 이벤트 발생 사이의 시간이 될 수도 있지만 확실하지는 않습니다). 또한 사용자 코드가 어디에서 발생하는지 정확히 알지 못하거나 EXIT_FRAME 및 FRAME_CONSTRUCTED에 대해 신경을 써야하는지 여부는 확실하지 않습니다.코드 실행의 다양한 단계를 측정하십시오.
많은 도움을 주셨습니다.
편집 ----
여기에 슈퍼 간단한 플렉스 응용 프로그램의 두 번째 프레임의 각 반복의 주요 이벤트를 보여주는 코드 조각입니다. 내가 알아 내려고하는 것은 고전적인 Flex 경마장의 "사용자 코드"와 "렌더링"부분과 내가 추적하고있는 네 가지 주요 신호 사이의 간격 사이에 명확한 관계가 있는지 여부입니다.
코드 :
는<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import flash.utils.getTimer;
public var t:Timer;
protected function button1_clickHandler(event:MouseEvent):void
{
t = new Timer(40, 50);
t.addEventListener(TimerEvent.TIMER, handleTimeTick);
t.addEventListener(TimerEvent.TIMER_COMPLETE, timerDone);
addEventListener(Event.RENDER, application1_renderHandler);
addEventListener(Event.ENTER_FRAME, application1_enterFrameHandler);
addEventListener(Event.EXIT_FRAME, application1_exitFrameHandler);
addEventListener(Event.FRAME_CONSTRUCTED, application1_frameConstructedHandler);
t.start();
}
protected function handleTimeTick(e:TimerEvent):void
{
shape.x += 5;
}
protected function timerDone(e:TimerEvent):void
{
t.stop();
t.removeEventListener(TimerEvent.TIMER, handleTimeTick);
t.removeEventListener(TimerEvent.TIMER_COMPLETE, timerDone);
removeEventListener(Event.RENDER, application1_renderHandler);
removeEventListener(Event.ENTER_FRAME, application1_enterFrameHandler);
removeEventListener(Event.EXIT_FRAME, application1_exitFrameHandler);
removeEventListener(Event.FRAME_CONSTRUCTED, application1_frameConstructedHandler);
}
protected function application1_renderHandler(event:Event):void
{
trace("render fire", getTimer());
}
protected function application1_enterFrameHandler(event:Event):void
{
trace("enter frame fire", getTimer());
}
protected function application1_exitFrameHandler(event:Event):void
{
trace("exit frame fire", getTimer());
}
protected function application1_frameConstructedHandler(event:Event):void
{
trace("frame constructed fire", getTimer());
}
]]>
</fx:Script>
<s:Rect id="shape" x="0" y="0" height="20" width="20">
<s:fill>
<s:SolidColor color="0xff0000"/>
</s:fill>
</s:Rect>
<s:Button x="10" y="100" click="button1_clickHandler(event)" label="go"/>
</s:Application>
나는 이것에 대한 답을 알고 싶다. 나는 누가 그랬는지 알고있다. ** Kirupa ** 플래시 포럼에서 답변을 찾으십시오. ** Senocular **는 짐승이다. – Jacksonkr