让flash的弹出窗口不再被拦截[转]

2008-10-16 10:08:49

原文地址:http://www.ultrashock.com/forums ... solution-92036.html 正常如果我们在flash里执行open window的话,都会被浏览器给拦截了,需要点一下允许弹出窗口才行,因为flash是在它自己的容器里,而不是document里,所以无法取得浏览器的信任,那要取得浏览器的信任,就需要做一点小动作。 把wmode设置为opaque或者transparent,这样就能把flash添加到dom里,从而取得浏览器的信任。但如果这样设置的话,flash激活的时候,周围会有虚框,所以还要做一下手脚,就是把outline的属性设置为none。[code]<!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Strict//EN&#34;&#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&#34;><html lang=&#34;en&#34; xml:lang=&#34;en&#34; xmlns=&#34;http://www.w3.org/1999/xhtml&#34;> <head> <title></title> <meta http-equiv=&#34;content-type&#34; content=&#34;text/html; charset=UTF-8&#34;/> <style type=&#34;text/css&#34;> object{ width:800px; height:500px; display:block; } object:focus{ outline:none; } </style> </head> <body> <object id=&#34;flash&#34; type=&#34;application/x-shockwave-flash&#34; data=&#34;movie.swf&#34;> <param name=&#34;movie&#34; value=&#34;movie.swf&#34;/> <param name=&#34;wmode&#34; value=&#34;opaque&#34;/> </object> </body> </html> [/code] AS [code]import flash.external.ExternalInterface; function openWindow(){ var url:String = &#34;http://www.blueidea.com&#34;; var windowName:String = &#34;mywindow&#34;; var windowOptions:String = &#34;width:800,height:600&#34;; ExternalInterface.call(&#34;window.open&#34;,url,windowName,windowOptions); } stage_btn.onRelease = function() { openWindow(); }; [/code] 官方的做法:http://www.adobe.com/cn/support/flash/ts/documents/popup_windows.htm [down=attachments/month_0810/x20081016101049.zip]点击下载此文件[/down]