0
votes

In Flex 3 I had my AIR application setup to always have the native window being invisible at startup so that the app can recall stored window position and size from a local shared object. After that it sets the last used window pos and size and THEN it makes the native window visible by calling nativeWindow.activate().

Very clean, always worked flawless! Now enter Flex 4 ...

In Flex 4 the visible property in the AIR descriptor file seems to be ignored for some reason. The documentation states that it should work but in my simple test AIR always makes the window visible instantly after launch, regardless if I have set visible to false.

Does anyone know how to get this working like it was in Flex 3?

EDIT: Ok so the docs state that the Flex mx:WindowedApplication (and s:WindowedApplication?!?) component automatically displays and activates the window immediately before the applicationComplete event is dispatched, unless the visible attribute is set to false in the MXML definition.

This explains why it goes visible all by itself even if it somehow defies the purpose of setting visible to false in the first place. However if setting WindowedApplication.visible to false the app window shortly goes visible as intended but then instantly goes invisible again after a fraction of a second. It seems that nativeWindow.activate() is called too soon because if I wait for one frame and then call it, it works as it should and stays visible. However I doubt this is best practice to use callLater or an enterFrame handler to wait for the next frame to be triggered.

1

1 Answers

0
votes

Have you tried to put visible in false when the application is initalizing? Put this on your WindowedApplication Tag.

initialize="visible=false" creationComplete="visible=true"