问题
When ‘wmode’ in instigated and a user is playing a Flash game requiring arrow keys, on Internet Explorer the browser window also moves. Seemingly, the only way round this is to remove the ‘wmode.’ But, if the ‘wmode’ is removed the Flash game rises to the top of the stacking order and all other elements such as expandable banners or dropdown menus go behind the Flash. No amount of iFrames or CSS resolves this issue.
I have found a solution that lets the ‘wmode’ remain, whilst also enabling the Flash game to have keyboard focus once clicked and therefore the Internet Explorer browser window does not move. This solution means other Dom elements can go above the Flash.
I have put the AS3 code below into a simple example and it seems to work. It basically puts a scrollPane in the content and then this is made invisible.
Being a PHP developer and not an AS3 developer, my questions is – can any AS3 developers see an issue or detrimental impact of placing the code below into a Flash based/AS3 built game. Equally could this work in AS2?
Much appreciated
_scrollPane = new ScrollPane();
_scrollPane.setSize(stage.stageWidth, stage.stageHeight);
_scrollPane.horizontalScrollPolicy = ScrollPolicy.OFF;
_scrollPane.verticalScrollPolicy = ScrollPolicy.OFF;
_scrollPane.alpha=0;
stage.addChild(_scrollPane);
回答1:
After a bit more testing it appears this is not realistically a viable option. Although the swf file gains focus once clicked and sprites requiring arrow key control can be moved without affecting the browser window, clicking or dragging interaction with sprites is prevented due to the child index of the scrollPane.
I’ve been playing around with the pre-release of IE10 and it appears no matter what state the wMode is left in (or removed) the browser window is still affected by arrow key interaction with the swf. If anyone else has come across this problem or found an answer it would be greatly appreciated.
来源:https://stackoverflow.com/questions/11411510/flash-wmode-as3-arrow-key-focus-on-internet-explorer-stacking-order-and-a-p