//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package flashx.textLayout.events { import flash.events.Event; import flash.events.MouseEvent; import flashx.textLayout.elements.FlowElement; /** A LinkElement dispatches this event when it detects mouse activity. * The Text Layout Framework includes this special version of mouse events * because mouse events are generally unwanted when a link element is * embedded in an editable text flow. *
You can add an event listener to a LinkElement to listen for this
* type of event. If you choose to cancel the event by calling
* Event.preventDefault()
, the default behavior associated
* with the event will not occur.
*
If you choose not to add an event listener to the LinkElement, or * your event listener function does not cancel the behavior, the * event is again dispatched, but this time by the LinkElement's * associated TextFlow instance rather than by the LinkElement itself. * This provides a second opportunity to listen for this event with * an event listener attached to the TextFlow. *
*FlowElementMouseEvents are * dispatched only when the text cannot be edited or when the control key * is pressed concurrently with the mouse activity.
** The following six event types are dispatched only when the text * cannot be edited or when the control key is pressed: *
MouseEvent.CLICK
MouseEvent.MOUSE_DOWN
MouseEvent.MOUSE_OUT
MouseEvent.MOUSE_UP
MouseEvent.ROLL_OVER
MouseEvent.ROLL_OUT
MouseEvent.CLICK
MouseEvent.MOUSE_DOWN
MouseEvent.MOUSE_OUT
MouseEvent.MOUSE_UP
MouseEvent.MOUSE_OVER
MouseEvent.MOUSE_OUT
* In most cases the original event matches the event that the
* LinkElement dispatches. The events match for the click
,
* mouseDown
, mouseOut
, and mouseOver
* events. There are two cases, however, in which the original event
* is converted by the LinkElement to a related event.
* If a LinkElement detects a mouseOver
event, it dispatches
* a rollOver
event. Likewise, if a LinkElement detects
* a mouseOut
event, it dispatches a rollOut
event.
*
type
property. There are six types:
* MouseEvent.CLICK
; MouseEvent.MOUSE_DOWN
; MouseEvent.MOUSE_OUT
;
* MouseEvent.MOUSE_UP
; MouseEvent.ROLL_OVER
; and MouseEvent.ROLL_OUT
.
* @param bubbles Determines whether the Event object participates in the bubbling phase of the
* event flow. FlowElementMouseEvent objects do not bubble.
* @param cancelable Determines whether the Event object can be canceled. Event listeners can
* access this information through the inherited cancelable
property. FlowElementMouseEvent
* objects can be cancelled. You can cancel the default behavior associated with this event
* by calling the preventDefault()
method in your event listener.
* @param flowElement The instance of FlowElement, usually a LinkElement, associated with this
* event. Event listeners can access this information through the flowElement
property.
* @param originalEvent The original mouse event that occurred on the flowElement. Event listeners can
* access this information through the originalEvent
property.
* @playerversion Flash 10
* @playerversion AIR 1.5
* @langversion 3.0
*/
public function FlowElementMouseEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = true, flowElement:FlowElement = null, originalEvent:MouseEvent = null)
{
super(type, bubbles, cancelable);
_flowElement = flowElement;
_originalEvent = originalEvent;
}
/** @private */
override public function clone():Event
{
return new FlowElementMouseEvent(type, bubbles, cancelable, flowElement, originalEvent);
}
}
}