How do I make flex only consume mouse scroll and keyboard events when it's useful, and otherwise pass it on to the browser?

我怕爱的太早我们不能终老 提交于 2019-12-01 21:56:17

Communication between the browser and flash is done via ExternalInterface. ExternalInterface allow you to call ActionScript methods from JavaScript and vice-versa.

Good luck with that because experience shows it's often painfull to deal with keyboard shortcuts and browser inconstancy

I faced the same problem. But the solution I went for requires extensive changes if you have a complex UI already built in flex.

Make the user interface using HTML and communicate via javascript with a hidden flex (or flash) object.

For example, pass whatever string you want to show in flex textarea as a parameter in an ExternalInterface call. Then show that string in a regular <textarea> html tag.

This strategy has worked well for my projects

Add an event that will handle if you are inside the flash when you are inside the flash call External interface to disable scrolling and get Focus for flash.

When you go outside the flash you still might be able to trigger the event an still call an External interface to get focus to browser and stop the flash scrolling.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!