Skip to main content
Known Participant
March 8, 2013
Question

Launch desktop AIR app from swf button

  • March 8, 2013
  • 1 reply
  • 416 views

I have a very simple task. I have an AIR app installed. All I want to be able to do is launch it from a swf button. I am building the swf button in Flash CS6. How do I do this? All it has to do is launch the app. No fancy stuff, no installs, no validation. Just launch the darn app. I can't seem to find a simple solution. Thanks!

This topic has been closed for replies.

1 reply

khussieAuthor
Known Participant
March 8, 2013

Not sure exactly why yet, but I finally found something that worked!!!! Hope this saves someone else hours of research:

myCustomBtn.addEventListener(MouseEvent.MOUSE_DOWN, versionDetectCallback);

var _air:Object;

var _loader:Loader;

var appID:String = "thenameofmyapp";

var pubID:String = " "; 

function loadAir() : void

{

_loader = new Loader();

var loaderContext:LoaderContext = new LoaderContext();

loaderContext.applicationDomain = ApplicationDomain.currentDomain;

_loader.contentLoaderInfo.addEventListener(Event.INIT,onInit);

_loader.load(new   URLRequest("http://airdownload.adobe.com/air/browserapi/air.swf"),loaderContext);

}

function onInit(event:Event) : void

{

_air = event.target.content;

        //the pubID argument resolves to and empty string ""  

        _air.getApplicationVersion(appID, pubID, versionDetectCallback);

}

function versionDetectCallback(event:MouseEvent) : void

{

       _air.launchApplication(appID,pubID);

}

loadAir();