What is the difference between rollover and mouseover




















MouseOver events on father: 1st. The mouse moves to the background, but has not touched the button, this time father issued a MouseEvent. Then move the mouse to the button, then father will send a MouseEvent. Then we continue to monitor father MouseEvent. Then move the mouse to the button, at this time father did not issue MouseEvent. From the above small experiment, we should be able to distinguish the subtle difference between the two events.

I believe that experienced friends must also guess the reason. RollOver and mouseOver also trigger events when the mouse moves to the target. The subtle difference is that the bubbles of mouseOver are equal to true, while the bubbles of rollOver are false. So when the mouse is monitored for the MouseEvent.

Suppose we listen to MouseEvent. Regarding bubbling, I have to mention the event flow of AS3. Simply put, it is a cyclic process of capture-target-bubbling: after the event occurs, it starts from the root container in the display layer and captures it one by one until it reaches the bottom.

The target object that dispatches the event then returns to bubble up, and the target attribute in this event always points to the innermost dispatch event target, and currentTarget, as the name implies, points to the current object in the event stream. After the event occurs, from the root node to the parent node of the target node, all nodes in between have two opportunities to respond to the event, in the capture and bubbling phases.

Registering a listener on any node that the event flow passes through will trigger. Of course, the premise is that the capture and bubbling functions are turned on. By default, the capture function is turned off, because in actual development, the monitoring target is very clear and there is no need to capture. The event will bubble up only when the bubbles attribute is true.

Once the capture is turned on, the default bubbling will be cancelled. Therefore, you cannot open capture and bubbling at the same time in the same listener, you can only register two listeners, one to capture and the other to open bubbling. Only visual objects containers, controls have the capture and bubbling phase, while non-visual objects such as XML and WebService have only the target phase. Connect and share knowledge within a single location that is structured and easy to search.

From the AS3 documentation :. The mouseOver event is dispatched each time the mouse enters the area of any child object of the display object container, even if the mouse was already over another child object of the display object container.

This is different behavior than the purpose of the rollOver event, which is to simplify the coding of rollout behaviors for display object containers with children. When the mouse enters the area of a display object or the area of any of its children from an object that is not one of its children, the display object dispatches the rollOver event.

The rollOver events are dispatched consecutively down the parent chain of the object, starting with the highest parent that is neither the root nor an ancestor of the relatedObject and ending with the object. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Ask Question. Asked 10 years, 3 months ago. Active 10 years, 3 months ago.



0コメント

  • 1000 / 1000