好的,首先我遇到了“窗口”默认 wmode 的两个问题。我的网页导航菜单将位于我的 Flex/Flash 应用程序下。另一个问题是在 Flash 应用程序中滚动时整个页面都会滚动。
我将 wmode 更改为“不透明”,这解决了导航菜单的问题,因此现在它们显示在 Flash 应用程序上方。那太好了,但现在我在 Flash 应用程序中根本没有滚动功能。
我意识到这是一个大问题,但我似乎找不到任何解决方案来解决这两个问题(实际上是 2.5 个问题)。
我想要 A) 让导航链接显示在 Flash 应用程序上方,这样它们就不会被隐藏; B) 允许在 Flash 应用程序内滚动; C) 如果鼠标位于 Flash 应用程序上方,则阻止网页滚动。
如果你们有任何想法那就太好了。 :) 提前致谢。
Ok so first I was having 2 issues with default wmode of "window". My web page navigation menus would go under my flex/flash app. The other issue was when scrolling in the flash app the whole page would scroll.
I changed wmode to "opaque" and this fixed the issue with the navigation menus and so now they show up above the flash app. Thats great but now I dont have scrolling at all in the flash app.
I realize this is a big issue out there but I can't seem to find any solutions for solving both(actually 2.5 issues) of these problems.
I would like to A) Have navigation links show up above the flash app so they aren't hidden; B) Allow scrolling within the flash application; and C) Prevent scrolling of the web page if the mouse is over the flash app.
If you guys have any ideas that would be fantastic. :) Thanks in advance.
发布评论
评论(3)
我写的时候的意思是:
问题是这两种模式在大多数浏览器中都不能捕获flash中的
MOUSE_WHEEL
事件(我相信IE是唯一能够正确捕获MOUSE_WHEEL
事件的浏览器)。解决方案是通过 JavaScript 监听
MOUSE_WHEEL
事件:然后您需要使用
ExternalInterface.addCallback
为 JS 设置回调,以提醒 Flash>MOUSE_WHEEL
事件发生。wmode=transparent
&wmode=opaque
对于其他鼠标事件也有问题。What I meant when I wrote:
is that both modes do not capture the
MOUSE_WHEEL
event in flash in most browsers (I believe IE is the only browser to capture theMOUSE_WHEEL
event properly).The solution is to listen for the
MOUSE_WHEEL
event via JavaScript:You'll then need to use
ExternalInterface.addCallback
to set up a callback for JS to alert flash that aMOUSE_WHEEL
event took place.wmode=transparent
&wmode=opaque
have issues with other mouse events as well.修复了当 wmode="opaque" 时 Flex 应用程序中没有 MouseWheel 的问题(它实际上在 IE 中有效,只是在 Firefox 或 Chrome 中不起作用,可能在 Safari 或 Opera 中也不起作用)。这也修复了 Firefox 和其他浏览器之间不同的 MouseWheel 滚动速率。
将此 JavaScript 添加到您的包装器中:
。
并将这个支持类放入您的主 MXML 文件中(Flex4 的声明):
。
Fix for no MouseWheel in a Flex app when wmode="opaque" (it actually works in IE, just not Firefox or Chrome, probably not Safari or Opera either). This also fixes the different MouseWheel scroller rates between Firefox and everything else.
Add this JavaScript to your wrapper:
.
And drop this support class into your main MXML file (Declarations for Flex4):
.
在 zzzzBov 的良好链接之后,我实际上能够解决所有三个问题。这让我可以将鼠标滚动传递给 Flash 应用程序,而仅当鼠标位于 Flash 应用程序上方时才执行此操作。它还允许我的 Flash 应用程序保持“不透明”模式,这样它就不会位于页面上其他 HTML 元素之上。
可以在此处找到这样的示例
Javascript
Flex
I was actually able to solve all three issues after that good link from zzzzBov. This lets me pass the mouse scrolling to the flash app while only doing this if the mouse is over the flash app. It also allows my flash app to stay in "opaque" mode so that it is not above the other HTML elements on the page.
An example of this is found here
Javascript
Flex