Figure out if you are using AS3 code in an Adobe Air application

I use my code in both an Adobe Flex and in an Adobe Air application. As I want to use the native menus of Adobe Air I want to prevent that my self-built menu is being added to the Air application. Thus, I need to figure out if the code is running in a Flex or in an Air application. I do this by using the following structure:

var airApp:Boolean = false;
if(NativeApplication.nativeApplication) airApp = true;

Posted in Actionscript, Adobe Air, Flash, flex