2008年7月9日 星期三

AS3呼叫exe外部執行檔還有開啟新視窗網頁!!!

http://blogs.zdnet.com/Stewart/images/flash_logo.png

因為AS3無視按鈕!所以以下語法都是在時間軸上的!~

AS3呼叫外部exe執行檔,aa是按鈕,duckhugh.exe是執行檔

function clickHandler(event:MouseEvent):void {
    fscommand("exec", "DuckHugh.exe");
    trace("clickHandler");
}
aa.addEventListener(MouseEvent.CLICK, clickHandler);

AS3呼叫新視窗開啟網頁~bb是按鈕

bb.addEventListener(MouseEvent.CLICK, callLink);
function callLink(event:MouseEvent):void {
    var url:String = "http://duckhugh.spaces.live.com";
    var request:URLRequest = new URLRequest(url);
    try {
        navigateToURL(request, '_blank');                    :開啟目標類型
    } catch (e:Error) {
        trace("Error occurred!");
    }
}

AS3關閉當前FLASH執行檔Exe視窗,dd是按鈕!

dd.addEventListener(MouseEvent.CLICK, clickHandler1);
function clickHandler1(event:MouseEvent):void {
    fscommand("quit");
    trace("clickHandler1");
}

blogad