View Full Version : access to undefined property
zedder
03-26-2009, 03:57 PM
i have this code on my AIR application
var url = "http://www.adobe.com";
var urlReq = new air.URLRequest(url);
air.navigateToURL(urlReq);
it gives the error:
access to undefined property air.
i simply would like to open a web browser on click on the air application icon when runnning.
appreciate any helps
thanks
evride
03-26-2009, 08:06 PM
var url = "http://www.adobe.com";
var urlReq = new URLRequest(url);
navigateToURL(urlReq);
don't use air.whatever for everything. It's only used when using the classes air.net, air.update, and air.update.event.
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/
zedder
03-27-2009, 10:05 AM
I did as you wrote
i got this error "undefined method nagivateToUrl".
I would attach the simple code here
thanks for your replay
<code>
package
{
import flash.display.Loader;
import flash.display.NativeMenu;
import flash.display.NativeMenuItem;
import flash.display.NativeWindow;
import flash.display.Sprite;
import flash.desktop.DockIcon;
import flash.desktop.SystemTrayIcon;
import flash.events.Event;
import flash.net.URLRequest;
import flash.desktop.NativeApplication;
public class SysTrayApp extends Sprite
{
public function SysTrayApp():void{
NativeApplication.nativeApplication.autoExit = false;
var icon:Loader = new Loader();
var iconMenu:NativeMenu = new NativeMenu();
var exitCommand:NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Exit"));
exitCommand.addEventListener(Event.SELECT, function(event:Event):void {
NativeApplication.nativeApplication.icon.bitmaps = [];
NativeApplication.nativeApplication.exit();
});
if (NativeApplication.supportsSystemTrayIcon) {
NativeApplication.nativeApplication.autoExit = false;
icon.contentLoaderInfo.addEventListener(Event.COMP LETE, iconLoadComplete);
icon.load(new URLRequest("icons/AIRApp_16.png"));
var systray:SystemTrayIcon =
NativeApplication.nativeApplication.icon as SystemTrayIcon;
systray.tooltip = "AIR application";
systray.menu = iconMenu;
}
if (NativeApplication.supportsDockIcon){
icon.contentLoaderInfo.addEventListener(Event.COMP LETE,iconLoadComplete);
icon.load(new URLRequest("icons/AIRApp_128.png"));
var dock:DockIcon = NativeApplication.nativeApplication.icon as DockIcon;
dock.menu = iconMenu;
}
// stage.nativeWindow.close();
}
private function iconLoadComplete(event:Event):void
{
NativeApplication.nativeApplication.icon.bitmaps =
[event.target.content.bitmapData];
trace ("laoded")
var url = "http://www.adobe.com";
var urlReq = new URLRequest(url);
navigateToURL(urlReq);
}
}
}
</code>
fx.barrett
03-27-2009, 12:10 PM
In order to use navigateToURL you need to import flash.net.navigateToURL;
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.