Hi, I am getting error #1009 in my code when i try to install the application. I am new to action script and below is the code for my installer.
var airSWF:Object; // This is the reference to the main class of air.swf
var airSWFLoader:Loader = new Loader(); // Used to load the SWF
var loaderContext:LoaderContext = new LoaderContext();
// Used to set the application domain
var paramObjAppid:Object = LoaderInfo(this.root.loaderInfo).parameters.appid;
//var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
airSWFLoader.contentLoaderInfo.addEventListener(Event.INIT, onInit);
airSWFLoader.load(new URLRequest("http://airdownload.adobe.com/air/browserapi/air.swf"),
loaderContext);
function onInit(e:Event):void
{
airSWF = e.target.content;
}
var url = '';
var qty = '';
var appID = '';
var pubID = "";
var runtimeVersion = "3";
var tf:TextField = new TextField(); // create a TextField names tf for debugging
tf.autoSize = TextFieldAutoSize.LEFT;
//tf.size = 4;
tf.wordWrap = true;
tf.border = true;
addChild(tf);
try
{
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; //set the paramObj variable to the parameters property of the LoaderInfo object
for (keyStr in paramObj)
{
valueStr = String(paramObj[keyStr]);
if ( keyStr == 'qty' ) {
qty = Number(valueStr);
}
if ( keyStr == 'url' ) {
url = escape(valueStr);
}
if ( keyStr == 'appid') {
appID = valueStr;
}
}
}
catch (error:Error)
{
}
var arguments:Array = [qty];
launchBtn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
function fl_MouseClickHandler_2(event:MouseEvent):void
{
airSWF.getApplicationVersion(appID, pubID, versionDetectCallback);
}
function versionDetectCallback(version:String):void
{
if (version == null)
{
trace("Not installed.");
tf.appendText('Not Installed');
try {
airSWF.installApplication(url, runtimeVersion, arguments);
}
catch (error:Error){
tf.appendText(error.toString());
}
}
else
{
trace("Version", version, "installed.");
tf.appendText("appID="+appID);
try {
airSWF.launchApplication(appID, pubID );
}
catch(error:Error) {
tf.appendText(error.toString());
}
}
}