The new Flex 3.4 SDK has been released. Since Adobe still hasn’t gotten around to fixing this bug, I’ve again taken it upon myself to release my MonkeyPatched code for Flex 3.4 that allows you to use the Flex DragManager along side the Native DragManager in an AIR app. You can grab the code from SVN from my google code site.

I’ve been using the ObjectHandles flex library project for quite some time. It’s used in the Nitro-LM Admin tool to give us resizeable horizontal menus.
In the new version of ObjectHandles2, we have the ability to use Sprites as the drag handles to resize and move objects around the screen. I was recently made a committer on the project and have added some functionality to allow Degrafa to be used to draw the handles and rotate them along with the object. Check out Example7 that highlights this new functionality.
ObjectHandles2Example View Source is enabled
Off and on, I’ve been working making the Flex DragManager work in AIR. I’ve been vocal in trying to get SDK-13983 fixed. This feature is really useful because you have no control over the DragProxy’s alpha value in AIR because it’s controlled by the operating system. If all operating systems defaulted to 0.5 alpha, all would be well, but OSX thinks that the drag proxy should be completely opaque and Windows thinks it should be 0.5.
The MonkeyPatch to fix this issue was posted to my Google code repository. Its only problem was that the mouse cursor for drag feedback disappeared when you were using a child window. I’ve added one small patch to UIComponent which fixes this issue. Grab the latest code if this is of interest to you. Let me know here if you have trouble with it.
If you want to use both the nice Flex Dragmanager in an AIR app, you need to use a monkeypatch to make it work. I’ve taken the code about as far as I can on my own, so I’d like to enlist my reader’s help.
What you can do:
1.) Vote on https://bugs.adobe.com/jira/browse/SDK-13983
2.) Figure out how the low-level DragManager code works (better than I can) and help work on the monkeypatched code at http://code.google.com/p/andrewwestberg/
What works:
1.) Using Flex dragmanager inside an AIR WindowedApplication.
2.) Using the AIR dragmanager in the same app.
What’s broken:
1.) Using the Flex Dragmanager inside mx:Window. The cursor disappears while dragging.
2.) Flex dragmanager between mx:Windows (not sure DragManager was ever designed for this)
3.) Other stuff I haven’t tested yet.
If you’re reading this, you’re likely aware that Adobe has released ANT tasks for compiling SWFs, module SWFs, and SWCs. My application has lots of modules and also uses an ANT build, so naturally, I wanted to speed up compile times.
My development laptop has a dual-core CPU and I noticed that one core was unused while running my ANT script. In order to speed up my compile times, I simply added <parallel> tags around compiling my modules. My main swf needs to be compiled first because I need to use its link report for building the other modules. I also had to make sure to set the threadCount property to 2 so it wouldn’t overload my machine trying to compile all the modules at once.
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="NitroAdminFlex" basedir="." default="AIR">
<property name="version.major" value="6"/>
<property name="version.minor" value="0"/>
<property name="version.revision" value="0"/>
<property name="OPTIMIZE" value="true"/>
<property name="DEBUG" value="false"/>
<property name="FLEX_HOME" value="C:/Program Files/Adobe/Flex Builder 3 Plug-in/sdks/3.2.0"/>
<property name="flex.mxmlc" location="${FLEX_HOME}/bin/mxmlc.exe" />
<property name="src.dir" value="."/>
<property name="lib.dir" value="../libs"/>
<property name="out.dir" value="../bin-release"/>
<property name="jars.dir" value="../../jars-server"/>
<taskdef name="nitrolm-encrypt" classname="com.simplifiedlogic.nitrolm.LMEncryptAsset" classpath="${jars.dir}/AssetEncrypterX.jar"/>
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
<target name="clean" description="Clean the project">
<delete dir="${out.dir}" failonerror="false"/>
</target>
<target name="init" description="initialize the project" depends="clean">
<mkdir dir="${out.dir}"/>
<copy todir="${out.dir}" includeemptydirs="false">
<fileset dir="${basedir}">
<exclude name="**/*.as"/>
<exclude name="**/*.mxml"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.css"/>
<exclude name="**/*.properties"/>
<exclude name="**/*.ser"/>
<exclude name="**/*.vser"/>
<exclude name="**/*.pfx"/>
<exclude name="**/*.txt"/>
<exclude name="**/*.cmd"/>
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="compile.release" description="Compile swf modules and main swf" depends="init">
<!-- compile main SWF -->
<mxmlc file="NitroAdminFlex.mxml" output="${out.dir}/NitroAdminFlex.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
link-report="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<parallel threadCount="2">
<!-- compile modules -->
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/nav/MainWindowNavigator.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/nav/MainWindowNavigator.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/DefineVariablesModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/DefineVariablesModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/NotificationsModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/NotificationsModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/MessagingModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/MessagingModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageLicensesModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageLicensesModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/UsersModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/UsersModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageVariablesModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageVariablesModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowUnconfirmedModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowUnconfirmedModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowPaidToModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowPaidToModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowDemosModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowDemosModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowLicensesModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowLicensesModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowMsgHistModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowMsgHistModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowSupportModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowSupportModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowUserFilesModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowUserFilesModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/AddEditProductModule.mxml" output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/AddEditProductModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowReportBuilderModule.mxml"
output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowReportBuilderModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/AddEditCompanyModule.mxml"
output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/AddEditCompanyModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowExternalVariablesReportModule.mxml"
output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowExternalVariablesReportModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/PoolPropertiesModule.mxml"
output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/PoolPropertiesModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
<mxmlc file="com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageAdminToolModule.mxml"
output="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageAdminToolModule.swf"
debug="${DEBUG}"
optimize="${OPTIMIZE}"
load-externs="${out.dir}/report.xml"
locale="en_US"
allow-source-path-overlap="true"
configname="air">
<compiler.context-root>/NitroAdminFlex</compiler.context-root>
<source-path path-element="${src.dir}"/>
<source-path path-element="locale/{locale}"/>
<library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
<include name="{locale}"/>
</library-path>
<library-path dir="${lib.dir}" append="true">
<include name="*.swc"/>
</library-path>
<library-path dir="../../FlexUtilLibrary/bin" append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
</parallel>
</target>
<target name="encrypt" description="Encrypt the various swf modules" depends="compile.release">
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/DefineVariablesModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/NotificationsModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/nav/MainWindowNavigator.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/MessagingModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageLicensesModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/UsersModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageVariablesModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowUnconfirmedModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowPaidToModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowDemosModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowLicensesModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowMsgHistModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowSupportModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowUserFilesModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/AddEditProductModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowReportBuilderModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/AddEditCompanyModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ShowExternalVariablesReportModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/PoolPropertiesModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
<nitrolm-encrypt
filename="${out.dir}/com/simplifiedlogic/nitroadmin/cairngorm/view/screens/ManageAdminToolModule.swf"
product="YOXxycCnrspZhEVOnhYE"
library="LKX_BYkNwSH4yZJosmHEXooO"
keydir="."/>
</target>
<target name="AIR" description="Create the AIR package for our app" depends="encrypt">
<exec executable="${FLEX_HOME}/bin/adt.bat" failonerror="true">
<arg line="-package"/>
<arg line="-storetype pkcs12"/>
<arg line="-keystore ${src.dir}/thawte_codesigning.pfx"/>
<arg line="-storepass 5T00P1d"/>
<arg line="${out.dir}/NitroAdmin.air"/>
<arg line="${src.dir}/NitroAdminFlex-app.xml"/>
<arg line="-C ${out.dir} NitroAdminFlex.swf"/>
<arg line="-C ${out.dir} assets*"/>
<arg line="-C ${out.dir} com*"/>
<arg line="-C ${out.dir} org*"/>
</exec>
</target>
</project>
The 360|Flex event in San Jose was a success in my book. I manned the Simplified Logic booth most of the time, but I did find some time to go to some great sessions. I learned many tips and tricks that I could apply to my own development efforts.
My session on Encrypting Flex was fairly well attended. There were lots of good questions from the audience. I probably could have done a better job preparing for my talk, but I’ll wait until the comments come back from the surveys to flagellate myself over that too much.
Without further ado, here are the materials from my presentation. The audio will have to wait until my presentation gets uploaded to the Adobe Media Player RSS Feed.
Encrypting Flex, Protecting Revenue, and Making Cash (PDF)
flexembeddingexample1 (zip)
flexencryptionexample1 (zip)
flexencryptionexample2 (zip)
flexencryptionexample3 (zip)
I’m working on some new types of SWF file encryption to demonstrate at 360 Flex San Jose. If you’ve read my Inside RIA articles, you know that the main technique used by NitroLM to encrypt swf files is to create a wrapper application and load/decrypt the real application using a SWFLoader. The problem with this technique is that it’s a little bit kludgy and adds deployment complexity. It also has some difficulty in AIR in that if you wrap an <mx:Application> inside an AIR app, you won’t be able use some of the Native AIR functionality.
I’ve been dilligently working on a new technique for encrypting modular applications. Basically, you’ll write your flex or AIR app as you normally would and break up functionality into modules loaded by <mx:ModuleLoader>. You could also put pretty much all of your code in a single module if you wanted to. Then, when you’re ready to deploy, just comment out the <mx:ModuleLoader> tags and replace them with <nitrolm:EncryptedModuleLoader> tags.
There’s a few other steps including encrypting the module SWFs with an AIR application called AssetEncrypter, but the process is much more straightforward than the wrapper technique. It’s also much easier for the developer to code because they don’t have to deal with the keys and decryption themselves. All of the complex functionality has been done for you in the <nitrolm:EncryptedModuleLoader>
Here are my 3 articles for InsideRIA on Encryption in Flex applications.
Encryption in Flex Applications 1 – Simulate EncryptedLocalStore
Encryption in Flex Applications 2 – SWC AS3 Library Encryption
Encryption in Flex Applications 3 – NitroLM SWF Encryption
Since attending 360Flex in Atlanta, I wanted to learn a bit about skinning with Degrafa. For one of my own personal projects, I needed to create some nice scrollbars that would go with my black and purple color scheme. Now keep in mind that I am NOT a designer. Most of my coding experience before learning Flex/AIR centered around backend Java Servlets and other hidden technology. View-Source is enabled if you wanted to see how it’s done. I still don’t know how to get rid of the stupid white box between the two scrollbars. If someone would like to comment and let me know, that’d be great.
I’m not really sure what Adobe has been thinking regarding DragManagers in Flex/AIR. The code makes a very basic and very WRONG assumption that in an AIR app using WindowedApplication, you will only ever want to use the NativeDragManager class. DragManager loads up a singleton class to handle drag and drop. Depending on whether your app is AIR or Flex and what your top-level container is you either get DragManagerImpl (the flex drag manager) or NativeDragManagerImpl. Unfortunately, this class has some really annoying limitations. You can’t specify an alpha level for the drag proxy. It’s hardcoded to 0.5 and there’s nothing you can do about it. Here’s what adobe has to say about it…
When a Flex application runs in Adobe® AIR™, you can control whether the application uses the Flex drag manager or the AIR drag manager. These drag managers are implemented by the classes mx.managers.DragManager (Flex drag manager) and flash.desktop.NativeDragManager (AIR drag manager).
Internally, the Flex mx.managers.DragManager class uses an implementation class to determine which drag manager to use. It uses either the Flex mx.managers.DragManagerImpl class, or the AIR mx.managers.NativeDragManagerImpl class.
By default, a Flex application defined by the <mx:Application> tag uses the Flex drag-and-drop manager, even when the Flex application runs in AIR. If you run your Flex application in AIR, and you want to take advantage of the AIR drag-and-drop manager to drag and drop items from outside of AIR, then you must configure the Flex mx.managers.DragManager class to use the AIR drag-and-drop manager.
There are three scenarios that determine which drag-and-drop manager your Flex application uses when running in AIR:
- Your main application file uses the <mx:Application> tag. In this scenario, you use the Flex drag-and-drop manager, and cannot drag and drop items from outside of AIR.
- Your main application file uses the <mx:WindowedApplication> tag. In this scenario, you use the AIR drag-and-drop manager, and can drag and drop items from outside of AIR.
- Your main application file uses the <mx:Application> tag, but loads the AIR drag-and-drop manager as represented by the mx.managers.NativeDragManagerImpl class. In this scenario, you use the AIR drag-and-drop manager, and can drag and drop items from outside of AIR.
Now what am I to do if I want option 4? I want all the window dressing goodness that comes with WindowedApplication like maximize, minimize, and a status bar, but I want the fully customizable Flex version of the drag manager implementation. Time to MONKEYPATCH!
The first thing you’ll need is to copy the framework classes mx.managers.SystemManager and mx.core.Version into your AIR app at the right locations.

Next, you edit one line of code in SystemManager.as so that it loads the DragManagerImpl instead of NativeDragManagerImpl. Find the method docFrameHandler. You should see a bit of code that looks like this…
if (Capabilities.playerType == "Desktop")
{
Singleton.registerClass("mx.managers::IDragManager",
Class(getDefinitionByName("mx.managers::NativeDragManagerImpl")));
// Make this call to create a new instance of the DragManager singleton.
// This will allow the application to receive NativeDragEvents that originate
// from the desktop.
// if this class is not registered, it's most likely because the NativeDragManager is not
// linked in correctly. all back to old DragManager.
if (Singleton.getClass("mx.managers::IDragManager") == null)
Singleton.registerClass("mx.managers::IDragManager",
Class(getDefinitionByName("mx.managers::DragManagerImpl")));
}
Now change to look like this…
if (Capabilities.playerType == "Desktop")
{
Singleton.registerClass("mx.managers::IDragManager",
Class(getDefinitionByName("mx.managers::DragManagerImpl")));
Enjoy your AIR app with the Flex DragManager goodness.

