So I posted a question about Ant build scripts for AIR a few weeks ago and got some great answers, so here's another one.
I have an Ant build script that I'm using to build my AIR project. It builds everything and packages the application just fine. The app runs with no noticeable problems until you try to do any serialization with a class we have: ElasticDictionary. This class merely extends flash.utils.Dictionary with some convenience methods (like length() -- code is below). I have the [RemoteObject] metadata and this works flawlessly when the project is run from the Flex Builder debugger. It also works perfectly when the release build is exported via the Flex Builder Export Release Build... dialog. So my question is: what am I missing in my Ant build script that Flex Builder does for me? The class, ElasticDictionary, is in the project's src folder and I'm using the 3.4 SDK. Relevant (at least what I *think* is relevant) code below. Thanks in advance for your help! Ant Build Script: <exec executable="${MXMLC}" failonerror="true"> <arg value="-debug=false"/> <arg value="+flexlib=${SDK_HOME}/frameworks"/> <arg value="+configname=air"/> <arg value="-file-specs=${MAIN_SOURCE_FILE}"/> <arg value="-output=${BUILD_DIR}/${APP_ROOT_FILE}"/> <arg value="-keep-as3-metadata+=RemoteClass"/> <arg value="-library-path+=${SDK_HOME}/frameworks/libs"/> <arg value="-library-path+=${SDK_HOME}/frameworks/libs/air"/> <arg value="-include-libraries=${LIBS_DIR}/applicationupdater.swc"/> <arg value="-include-libraries=${LIBS_DIR}/Degrafa_Beta3.1_Flex3.swc"/> <arg value="-locale=en_US,fr_FR,de_DE"/> <arg value="-source-path=${LOC_DIR}/{locale}"/> <arg value="-source-path=${PROP_DIR}"/> </exec> SDK_HOME refers to the location of the Flex 3.4 SDK. LIBS_DIR points to the project's SWC's. LOC_DIR to localization files; PROP_DIR to properties (.properties) files. --- The ElasticDictionary class: /** * Used instead of ordinary dictionaries so that their data type can be preserved when saving in a serailized format */ package com.project.utils { import flash.utils.Dictionary; [Bindable] [RemoteClass] public dynamic class ElasticDictionary extends Dictionary { public function ElasticDictionary(weakKeys:Boolean=false) { super(weakKeys); } public function get length():uint { return getKeys().length; } public function getKeys():Array { var keys:Array = new Array(); for(var key:Object in this) { keys.push(key); } return keys; } public function getValues():Array { var values:Array = new Array(); for(var key:Object in this) { values.push(this[key]); } return values; } } }