Analysis and Handling of scroll bars in html and flash embedded in it _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.