Skip to main content
Known Participant
September 25, 2010
Question

Making an AIR auto launch swf

  • September 25, 2010
  • 1 reply
  • 713 views

I have a client asking me to make an auto launch swf for their AIR app, which I did not develop. I modified their current AIRInstallBadge and it works fine, but now they want a swf on a page that will just auto launch it with no interaction. Basically a swf with no UI, invisible. Is that possible? I've tried the following with no success:

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

var appID:String = validateString(paramObj.appid);

var pubID:String = validateString(paramObj.pubid);

var appLaunchArg:Array = validateString(paramObj.applauncharg) == null ? (null) : ([paramObj.applauncharg]);


var airSWF:Object;

var airSWFLoader:Loader = new Loader();

var AIR_SWF_URL:String = "http://airdownload.adobe.com/air/browserapi/air.swf";


airSWFLoader.load(new URLRequest(AIR_SWF_URL));

airSWFLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleAIRSWFError);

airSWFLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleAIRSWFInit);



function handleAIRSWFInit(event:Event) : void

{

     airSWF = airSWFLoader.content;

      airSWF.launchApplication(appID, pubID, appLaunchArg);

}


function handleAIRSWFError(event:IOErrorEvent) : void

{

    Text.text = "unable to load air.swf";

}


function validateString(param1:String) : String

{

return param1 == null || param1.length < 1 || param1.indexOf("<") >= 0 || param1.indexOf(">") >= 0 ? (null) : (param1);

}

I've tested and all parameters get loaded. I'm sure i'm missing some protocols or it's not possible for for security reasons. Any help would be appreciated.

Thanks,

Adam

This topic has been closed for replies.

1 reply

Known Participant
September 25, 2010

Never mind, I just found the answer. Nope you can't do it.

The launchApplication() method can only operate when called in the event handler for a user event, such as a mouse click.