New Window, MovieClip, or Stage with alternate framerate

Hi

I’m wondering if someone knows if it’s possible to create a MovieClip, a new Stage, or a new Lime Window which has different frame rate than the application’s main stage (or its main window’s stage).

I created new Lime windows with different frame rates, but the main stage seems to be static in code, so the other (original) window’s frame rate has changed as well (new window’s fps was set to 1, the original window’s fps changed to 1, along with the all of the existing displayobject stage’s frame rate).

I need to do some stuff in code, and I’m thinking of creating a low-frame-rate (1 fps) MovieClip (Stage, Window, anything) and do the necessary calculations by adding a listener to its ENTER_FRAME event, while keeping the main application fast and responsive (at 30-60 fps).

I know I can use Haxe threads, which is very exciting to work with, but in this specific case I’m curious if it’s somehow possible to create OpenFL display objects with different frame rate than the main (root) one.

Thank you.

I believe that the only display object that has a property to allow you to customize its frame rate is Stage.

In OpenFL, the Stage passes its frameRate property to the lime.ui.Window. Lime windows pass the frame rate to their “backend” for the current target. It looks like the C++ (NativeWindow) and html5 (HTML5Window) backends set an application global framerate, and they don’t allow windows/stages to have separate frame rates.

It’s probably technically possible, but it’s not implemented at this time.

What I would do is add Event.ENTER_FRAME, and use openfl.Lib.getTimer() to see if enough time has passed since the last update before proceeding with the calculations. This should have low enough overhead to keep everything else fast and responsive, since most of the calls to the listener will immediately return without running the calculations.

2 Likes

Thank you, Josh