伊莉討論區
標題:
背景執行程式按鈕問題
[打印本頁]
作者:
ffuitw
時間:
2015-3-26 08:59 PM
標題:
背景執行程式按鈕問題
本帖最後由 ffuitw 於 2015-3-26 09:10 PM 編輯
我用adobe air做一個背景執行程式按鈕命名VisibleWindow_ben在影格打入程式碼
//VisibleWindow_ben按鈕當按下時,發生onVisibleWindow函數
VisibleWindow_ben..addEventListener(MouseEvent.CLICK,onVisibleWindow);
//onVisibleWindow函數,定義載入系統匣icon圖示、系統匣圖示工具提示及背景執行程式動作
function onVisibleWindow(event:MouseEvent):void
{
var icon: Loader = new Loader();
NativeApplication.nativeApplication.autoExit = false;
icon.contentLoaderInfo.addEventListener(Event.COMPLETE, iconLoadComplete);
icon.load(new URLRequest("15.png"));
if (NativeApplication.supportsSystemTrayIcon)
{
var systray: SystemTrayIcon = NativeApplication.nativeApplication.icon as SystemTrayIcon;
systray.tooltip = "BaiYangTrave";
systray.menu = createSystemTrayMENU();
}
if (NativeApplication.supportsDockIcon)
{
var macIcon: DockIcon;
macIcon = this.nativeApplication.icon as DockIcon;
macIcon.menu = createSystemTrayMeun();
}
this.stage.nativeWindow.visible = false;
}
function iconLoadcomplete(event:Event):void
{
NativeApplication.nativeApplication.icon.bitmaps = [event.target.content.bitmapData];
}
function openHandler(event:Event):void
{
NativeApplication.nativeApplication.icon.bitmaps = [];
this.stage.nativeWindow.visible = true;
this.stage.nativeWindow.orderToFront();
}
function exitHandler(event:Event):void
{
NativeApplication.nativeApplication.icon.bitmaps = [];
NativeApplication.nativeApplication.exit();
}
function createSystemTrayMenu():NativeMenu
{
var trayMenu:NativeMenu=new NativeMenu();
var openMenuItem:NativeMenuItem = new NativeMenuItem("開啟");
openMenuItem.addEventListener(Event.SELECT.openHandler);
var openMenuItem:NativeMenuItem = new NativeMenuItem("關閉");
exitMenuItem.addEventListener(Event.SELECT.exitHandler);
trayMenu.addItem(openMenuItem);
trayMenu.addItem(new NativeMenuItem("",true));
trayMenu.addItem(exitMenuItem);
return trayMenu;
}我要測試時出現
字行 6 1120:存取未定義的屬性 iconLoadComplete
字行 12 1180:呼叫可能未定義的方法 createSystemTrayMENU
字行 18 1180:呼叫可能未定義的方法 createSystemTrayMeun
字行 41 1119:存取可能未定義的屬性 openHandler
字行 41 1136:引數個數錯誤。需要 2 個
字行 43 1120:存取未定義的屬性 exitMenuItem
字行 43 1119:存取可能未定義的屬性 exitHandler
字行 46 1120:存取未定義的屬性 exitMenuItem
要怎麼解決?AS3.0
歡迎光臨 伊莉討論區 (http://a404.file-static.com/)
Powered by Discuz!