[SOLVED] How to really know when everything is ready? (neko target bug?)

THIS ONLY HAPPEN IN NEKO TARGET, ALL OTHER TARGETS ARE OK

I’m trying to figure it out how to know when from the beginning (main) everything is ready.

Usually I would say just listen to the ADDED_TO_STAGE event.

But if I do it I lose almost 3 seconds of time when the window is NOT actually rendered.

Example:

class Main extends Sprite
{
    public function new () {
        super ();
        addEventListener (Event.ADDED_TO_STAGE, startup);
    }

    private function startup (event:Event):Void {
        trace('done');
        removeEventListener(Event.ADDED_TO_STAGE, startup);
    }
}

The trace DONE will be displayed when the window is still black.
After few seconds the window render my background (as set in project.xml)

It’s very easy to see this using a tween with Actuate.
If I put a tween on a picture with an alpha from 0 to 1 shorter than a second I will not see the transition, just the picture with alpha=1.

Could this be a bug in neko? Maybe wrong forum?

Try to use one-time enter_frame handler - add listener in your startup method.

1 Like

thank you @T1mL3arn
That’s the solution to my problem

I’ve tried every event I could and I din’t try the obvious one. facepalm
cheers

I think Neko takes a little extra time to warm up, when its still loading in the VM

Does it mean enter_frame sometimes will not help?

ENTER_FRAME works perfectly also in neko target.

It is the ADDED_TO_STAGE that happen before it actually show the stage on screen.

On the other platform the two events look like they are simultaneous.