A Stage object dispatches a StageOrientationEvent object when the
orientation of the stage changes. This can occur when the device is rotated,
when the user opens a slide-out keyboard, or when the setAspectRatio()
method of the Stage is called.
There are two types of StageOrientationEvent event: The
orientationChanging (StageOrientationEvent.ORIENTATION_CHANGING), is
dispatched before the screen changes to a new orientation. Calling the
preventDefault() method of the event object dispatched for
orientationChanging prevents the stage from changing orientation. The
orientationChange (StageOrientationEvent.ORIENTATION_CHANGE), is
dispatched after the screen changes to a new orientation.
Note: If the Stage.autoOrients property is false, then the stage
orientation does not change when a device is rotated. Thus,
StageOrientationEvents are only dispatched for device rotation when
Stage.autoOrients is true.
See also:
Static variables
staticinlineread onlyORIENTATION_CHANGE:EventType<StageOrientationEvent> = "orientationChange"
The ORIENTATION_CHANGE constant defines the value of the type
property of a orientationChange event object. This event has the
following properties:
| Property | Value |
|---|---|
afterOrientation | The new orientation of the stage. |
beforeOrientation | The old orientation of the stage. |
target | The Stage object that dispatched the orientation change. |
bubbles | true |
currentTarget | The object that is actively processing the Event object with an event listener. |
cancelable | false; it is too late to cancel the change. |
See also:
staticinlineread onlyORIENTATION_CHANGING:EventType<StageOrientationEvent> = "orientationChanging"
The ORIENTATION_CHANGING constant defines the value of the type
property of a orientationChanging event object. This event has the
following properties:
| Property | Value |
|---|---|
afterOrientation | The new orientation of the stage. |
beforeOrientation | The old orientation of the stage. |
target | The Stage object that dispatched the orientation change. |
bubbles | true |
currentTarget | The object that is actively processing the Event object with an event listener. |
cancelable | true |
See also:
Constructor
new(type:String, bubbles:Bool = false, cancelable:Bool = false, beforeOrientation:StageOrientation = UNKNOWN, afterOrientation:StageOrientation = UNKNOWN)
Creates a StageOrientationEvent object with specific information relevant to stage orientation events. Event objects are passed as parameters to event listeners. Generally you do not create this event using the constructor function. Instead, you add an event listener on the Stage object to detect these events as they occur.
Parameters:
type | The type of the event. Event listeners can access
this information through the inherited
|
|---|---|
bubbles | Determines whether the Event object bubbles. Event
listeners can access this information through the
inherited |
cancelable | Determines whether the Event object can be canceled.
Event listeners can access this information through
the inherited |
beforeOrientation | Indicates the orientation before the change. |
afterOrientation | Indicates the orientation after the change. |