O'Reilly logo

Professional Adobe® Flex® 3 by Joe Berkovitz, David Hassoun, Andrew Trice, Tom Sugden, Todd Prekaski, Jun Heider, Peter Ent, Joseph Balderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 70. Dual Deployment for Flex and AIR

By now, you've got a handle on developing Flex applications for rich Internet applications (RIAs). You've also learned how the AIR runtime facilitates the creation of desktop applications. Now you might be thinking, how do I build an application from the same codebase targeting both the browser and the desktop? If so, this chapter is for you.

By its nature, AIR contains all the FLEX APIs, plus the AIR-specific APIs. Projects compiled for Web-based distribution don't include the AIR APIs, so if you try to compile an AIR project for the Web, you'll receive "Type was not found" compile errors. And if you're using Flex Builder, you won't even be able to import any of the AIR APIs because the airglobal.swc and airframework.swc files aren't included as build path libraries for Flex projects targeting the Web.

This chapter will show two different methods of writing software for both the Web and desktop. The first method will use a design-by-interface approach, combined with multiple Flex Builder projects to create software that can be run inside the web browser as a Flex application or on the desktop with AIR. The second method is the use of the new Flex compiler directives, which will be more of a chainsaw approach to coding but won't require the upfront effort that the design-by-interface approach requires.

Coding by Interface

The first solution to create both AIR and Flex applications involves creating a few projects in Flex Builder. One project ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required