airSWF.getStatus()
hi,
i built flex app , trying launch air app after loading airswf looking @ various posts in forum. airswf.getstatus() shows 'available' instead of 'installed' though have air installed on system , can run air apps. there missing out ? here code attached, it's simple. user loads airswf , tries call apis since air isnt installed, fails.
<?xml version="1.0" encoding="utf-8"?>
<mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationcomplete="oncreationcomplete()">
<mx:script>
<![cdata[
private var appid:string = "testairapp";
private var pubid:string = "ca9ddeaf7d7360c95c34185b3c13953a5d184161.1" //"8b00a63502b9d572eacb3881facbb40fcdf23135.1" ;
public function oncreationcomplete():void
{
var loader:loader = new loader();
loader.contentloaderinfo.addeventlistener(event.init, function(e:event):void {
try {
var airswf:object = e.target.content;
var status:string = airswf.getstatus();
if ((status == 'available') || (status == 'installed')) {
airswf.getapplicationversion(appid, pubid,function(airversion:string):void{
if (airversion != null) {
downloadbutton.label = 'launch air version';
downloadbutton.addeventlistener(mouseevent.click,function():void {
airswf.launchapplication(appid, pubid);
});
}
if (downloadbutton.label.indexof('launch') == -1) {
downloadbutton.addeventlistener(mouseevent.click,function():void {
airswf.installapplication('testairapp.air','1.0');
});
}
downloadbutton.enabled = true;
});
}
}
catch (e:error) {
trace('error installing or checking air version:\n\n' + e.message);
}
});
var loadercontext:loadercontext = new loadercontext();
loadercontext.applicationdomain = applicationdomain.currentdomain;
loader.load(
new urlrequest(" http://airdownload.adobe.com/air/browserapi/air.swf"),
loadercontext);
}
]]>
</mx:script>
<mx:button id="downloadbutton" label="install local connection" />
</mx:application>
More discussions in Archived Spaces
adobe
Comments
Post a Comment