开发者

Flex app: framerate property is NaN

I have an AS3 App class e.g (pseudo code)

public class MyApp extends Application
{
        protected function onRender():void
        {
            trace("frameRate = "+frameRate);
        }
}

and this is then extended by the app MXML:

<MyApp width="100%" height="100%" frameRate="30" enterFrame="onRender()">
...
</MyApp>

The app appears to be running at the right speed, but in MyApp.onRender(), frameRate is seen as NaN (in the debugger too if I step through). Why is this? How should I be obtaining the application's FPS p开发者_如何学Croperty?


The Language Reference has this note for frameRate in the Application class:

Note: This property cannot be set by ActionScript code; it must be set in MXML code.

If you use stage.frameRate in your trace it should give you the framerate you assigned to the Application. You might need to throw a try-catch statement around the trace, since the enterFrame event can be dispatched before stage is instantiated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜