A.swfis redirected to the webpage, and a.swfand htmlpage have scroll lines at the same time. The Project Manager raises a demand for bt---processing a.swf, while the html page does not scroll, and vice versa. If you encounter this problem, please refer, I hope this article will help you. We often encounter this situation during development:
A.swf is added to the webpage. A. SWF and html pages have a scroll bar at the same time. The Project Manager raises a requirement for a bt---processing a.swf. When the mouse scrolls, the html page does not scroll. Otherwise, the html page is rolled!
What should I do?
Method 1:
1. When the mouse is moved to the.swf scroll area, notify JS to remove the browser and scroll the mouse to listen.
2.when the mouse is moved out of the. SWF scroll area: Notify JS to add a browser scroll listener.
3.a.swf wmode is set to "window ".
Summary: Setting wmode to "window" may not meet the project requirements, so that a.swf can block any html page under it; when you move the mouse to the.swf scroll area and press Alt + Tab to switch the page, the JS is not notified to add a browser scroll listener. Therefore, after the operation, it is not rolled back to the html page.
Method 2:
1.a.swf cancels its mouse scroll listening event and adds a scroll processing interface for JS calls, such as wheelToFlash (value ).
2.when the mouse is moved to the.swf scrolling area: Notify JS, for example, mouseIsInFlashWheelRange = true.
3.when the mouse moves out of the. SWF scrolling area: Notify JS, for example, mouseIsInFlashWheelRange = false;
4. JS listens to mouse scroll events. In the event listening and processing function, we need to make the following judgment:
Javascript code:
The Code is as follows:
If (mouseIsInFlashWheelRange = true)
{
/** Use a.swf's interface to simulate a. SWF rolling */
/** "Flash" is the ID of a.swf embedded in html, and value is the scrolling value of the html Rolling Table */
Document. getElementById ("flashID"). wheelToFlash (value );
/** Stop the bubble of html page mouse events, usually event. preventDefault ()*/
Event. preventDefault ();
}
Else
{
/** Handle normal html scrolling. We don't need to do anything */
}
Summary: Compared with method 1, wmode = "window" is absent; the Alt + Tab problem still exists.
Note:: When writing JavaScript code, we need to pay attention to compatibility issues. Different browsers listen to mouse events and obtain scroll values differently!