Just a quick tip for any AIR developer’s searching for why there’s no addChild method in the NativeWindow class – I wasted a fair while on this over the weekend. I was adding Flex components to the stage property of NativeWindow and trying various other work arounds. Although you don’t get errors for doing this the Flex components never appear when you test your app!

If you want to add Flex components to a new NativeWindow in AIR then this is what Window class is for. So don’t waste time creating a new NativeWindow and activating it, just create/subclass the Window class not NativeWindow and you’ll find all the stanard Flex component properties and methods 🙂

Duh!



2 Comments

  1. Quinn Madson

    thank you, thank you, thank you!

  2. John Levine

    There is a way of doing this.

    This problem is caused by the fact that the NativeWindow class does not create a system manager when it initialises – this is what is required to support all the Flex controls.

    The best way around this is to sub-class the NativeWIndow so it creates a system manager before you add any controls to it.

    There’s a code sample and explanation that lives here:

    http://www.ben-morris.com/howto-add-flex-mx-controls-to-a-nativewindow-for-adobe-air


Leave a reply