December 16, 2011 11:56 AM
Once you manually overlay a new AIR SDK over a Flex SDK, there are a couple of things that you need to do to use the new APIs. Flex 4.5 has a compiler option known as swf-version which is required to be set if you want to use new AIR/Player APIs in addition to bumping the namespace version in your application descriptor. What if you wanted to use the new AIR 3 APIs with an SDK older than 4.5? In my case, I wanted to move to native JSON decoding in a project that uses the Flex 4.0 SDK.

It is really simple, just use -target-version=13 in the additional compiler arguments. Use -swf-version if you are on Flex SDK 4.5 or higher.

Step by Step

Once you overlay the new AIR 3 SDK over the Flex 4 SDK:

1) Update your application descriptor file to the new version:

<application xmlns="http://ns.adobe.com/air/application/3.0">

2) Set target player in additional compiler arguments:

-target-player=13

This compiler option basically changes the data written to the SWF file (the first few bytes of a SWF). Both the namespace version and swf version in the file is checked before allowing new APIs to be used.

The symptoms you see when you try to use the new APIs without changing the descriptor version and target-version are not directly linked to the problem: You get a runtime Verify Error and the compiler not detecting this at compile-time just adds to the worry.

Useful Hint

If you use TLF, updating your namespace to 3.0 gives your fonts a much better look.

CategoryFlex

Copyright © 2004-2011 Anirudh Sasikumar. All rights reserved.
Last Updated: December 16, 2011 12:19 PM