Code Personal

The joy of coding

Part of writing code is knowing the vocabulary of the particular language.  I’ve been working with ActionScript for years and started the transition to AS3 about a year ago.  I’m currently working on my first AIR application.  AIR can be made  as either Flex or pure ActionScript based.  Since I’m using Eclipse, which by default only supports Flex based AIR apps, I was in Flex’s world and not knowing it’s little quirks I was hitting a wall.

Not knowing the quirks or vocabulary of Flex nor all of AIR’s additions, the search for answers in the documentation left me empty.  Since what I was searching for seemed so basic and simple that I didn’t expect not to find it.  The answers could have been there, I just never found it.

So what was this mysterious nugget I was looking for?  It was simple little thing, adding a Sprite to the stage.  Found how to make various window types and other interesting tid bits, but none of the samples were based on a Flex based AIR app, which is what I was building.  To say the least it was very frustrating.

Turns out that to add a child to a Flex window you can’t just use addChild(), as the Flex window is a FLEX component.  There is a special function called addrawChildren(), which adds a non-Flex component to a Flex component.  From there you can add sub-children via addChild() as you would in an ActionScript based project.  It’s always the little things.

This simple answer/lesson was given to me in less then 5 minutes by my co-worker, Arpit.  He also showed that it was possible to do a non-Flex based AIR app in Ecipse, so all this was for naught.