1. 舞台上佈署兩個影片實體popup1_mc, popup2_mc, 做為跳窗按鈕
2. 第一影格AS3
// popup1_mc.addEventListener(MouseEvent.MOUSE_DOWN, popupHandler_1); popup1_mc.buttonMode=true; function popupHandler_1(e:MouseEvent):void{ var features:String = "MM_openBrWindow('Flash_popup_a.html','popup','directories=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=360,height=351,left=300,top=150');"; var reqURL:URLRequest = new URLRequest("javascript:" + features); navigateToURL(reqURL, "_self"); //navigateToURL(new URLRequest("javascript:MM_openBrWindow('Flash_popup_a.html','popup','directories=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=360,height=351,top=100,left=100'); void(0);"); } // popup2_mc.addEventListener(MouseEvent.MOUSE_DOWN, popupHandler_2); popup2_mc.buttonMode=true; function popupHandler_2(e:MouseEvent):void{ var features:String = "MM_openBrWindow('Flash_popup_b.html','popup','directories=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=360,height=351,left=300,top=150');"; var reqURL:URLRequest = new URLRequest("javascript:" + features); navigateToURL(reqURL, "_self"); //navigateToURL(new URLRequest("javascript:MM_openBrWindow('Flash_popup_a.html','popup','directories=no,location=no,menubar=no,toolbar=no,scrollbars=no,width=360,height=351,top=100,left=100'); void(0);"); }
3. 母視窗HTML裡HEAD區段加入的JS碼
< script language="JavaScript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
< /script>
4. 跳出的子視窗的< body>標籤 -->當子視窗失去焦點時,就自動關閉.
< body onblur="window.close()" >
原始檔案下載
http://sites.google.com/site/terfict3/home/981120_as3_Flash_popup.rar
沒有留言:
張貼留言