Sunday, February 3, 2008

Multiple Windows in AIR

I was working on my MusicPlayer app and I wanted to open my player from the playlist manager in another window. This actually isn't very hard, but if you're not careful you'll open the new window and nothing will appear! That's because after you've initialize all the NativeWindow properties you MUST set the visible property to true. If you don't, the window is created but nothing is visible on screen.

Luckily for me I was opening a swf with sound or else I wouldn't never known something fishy was happening and might've thought I was initializing it incorrectly. I could hear the music but I couldn't see anything. After reviewing some examples, I could see the error of my ways.

On a similar note, make sure you set the stage.scaleMode and stage.align properties for the new window or else you may end up with a very odd sized loaded asset.

0 comments: