Drawers
Description
A container that displays primary content in the center surrounded by optional "drawers" that can open and close on the edges. Useful for mobile-style app menus that slide open from the side of the screen.
Additionally, each drawer may be individually "docked" in an always-open state, making this a useful application-level layout container even if the drawers never need to be hidden. Docking behavior may be limited to either portrait or landscape, or a drawer may be docked in both orientations. By default, a drawer is not docked.
The following example creates an app with a slide out menu to the left of the main content:
var navigator:ScreenNavigator = new ScreenNavigator(); var list:List = new List(); // the navigator's screens, the list's data provider, and additional // properties should be set here. var drawers:Drawers = new Drawers(); drawers.content = navigator; drawers.leftDrawer = menu; drawers.leftDrawerToggleEventType = Event.OPEN; this.addChild( drawers );
In the example above, a screen in the ScreenNavigator component dispatches an event of type Event.OPEN when it wants to display the slide out the List that is used as the left drawer.
Beta Component: This is a new component, and its APIs may need some changes between now and the next version of Feathers to account for overlooked requirements or other issues. Upgrading to future versions of Feathers may involve manual changes to your code that uses this component. The Feathers deprecation policy will not go into effect until this component's status is upgraded from beta to stable.
See also:
http://wiki.starling-framework.org/feathers/drawers
API overview
Constructor
Drawers
(
content: DisplayObject
= null
)
Constructor.
Attributes
Public attributes
| autoSizeMode: String |
Determines how the drawers container will set its own size when its dimensions (width and height) aren't set explicitly |
| bottomDrawer: DisplayObject |
The drawer that appears below the primary content |
| bottomDrawerDockMode: String |
Determines if the bottom drawer is docked in all, some, or no stage orientations |
| bottomDrawerToggleEventType: String |
When this event is dispatched by the content event dispatcher, the bottom drawer will toggle open and closed |
| clipDrawers: Boolean |
Determines if the drawers are clipped while opening or closing |
| content: DisplayObject |
The primary content displayed in the center of the container |
| contentEventDispatcherChangeEventType: String |
The event dispatched by the content to indicate that the content event dispatcher has changed |
| contentEventDispatcherField: String |
A property of the content that references an event dispatcher that dispatches events to toggle drawers open and closed |
| contentEventDispatcherFunction: Function |
A function that returns an event dispatcher that dispatches events to toggle drawers open and closed |
| isBottomDrawerDocked: Boolean |
read-only
Indicates if the bottom drawer is currently docked |
| isBottomDrawerOpen: Boolean |
Indicates if the bottom drawer is currently open |
| isLeftDrawerDocked: Boolean |
read-only
Indicates if the left drawer is currently docked |
| isLeftDrawerOpen: Boolean |
Indicates if the left drawer is currently open |
| isRightDrawerDocked: Boolean |
read-only
Indicates if the right drawer is currently docked |
| isRightDrawerOpen: Boolean |
Indicates if the right drawer is currently open |
| isTopDrawerDocked: Boolean |
read-only
Indicates if the top drawer is currently docked |
| isTopDrawerOpen: Boolean |
Indicates if the top drawer is currently open |
| leftDrawer: DisplayObject |
The drawer that appears below the primary content |
| leftDrawerDockMode: String |
Determines if the left drawer is docked in all, some, or no stage orientations |
| leftDrawerToggleEventType: String |
When this event is dispatched by the content event dispatcher, the left drawer will toggle open and closed |
| minimumDragDistance: Number |
The minimum physical distance (in inches) that a touch must move before a drag gesture begins |
| minimumDrawerThrowVelocity: Number |
The minimum physical velocity (in inches per second) that a touch must move before the a drawern can be "thrown" to open or close it |
| openGesture: String |
An optional touch gesture used to open a drawer |
| openGestureEdgeSize: Number |
The minimum physical distance (in inches) that a touch must move before a drag gesture begins |
| openOrCloseDuration: Number |
The duration, in seconds, of the animation when a drawer opens or closes |
| openOrCloseEase: Object |
The easing function used for opening or closing the drawers |
| rightDrawer: DisplayObject |
The drawer that appears to the right of the primary content |
| rightDrawerDockMode: String |
Determines if the right drawer is docked in all, some, or no stage orientations |
| rightDrawerToggleEventType: String |
When this event is dispatched by the content event dispatcher, the right drawer will toggle open and closed |
| topDrawer: DisplayObject |
The drawer that appears above the primary content |
| topDrawerDockMode: String |
Determines if the top drawer is docked in all, some, or no stage orientations |
| topDrawerToggleEventType: String |
When this event is dispatched by the content event dispatcher, the top drawer will toggle open and closed |
Protected attributes
Constants
Constants
| AUTO_SIZE_MODE_CONTENT: String |
static
The drawers container will auto size itself to fit its content |
| AUTO_SIZE_MODE_STAGE: String |
static
The drawers container will auto size itself to fill the entire stage |
| DOCK_MODE_BOTH: String |
static
The drawer will be docked in all orientations |
| DOCK_MODE_LANDSCAPE: String |
static
The drawer will be docked in landscape orientation, but it must be opened and closed explicitly in portrait orientation |
| DOCK_MODE_NONE: String |
static
The drawer won't be docked in any orientation |
| DOCK_MODE_PORTRAIT: String |
static
The drawer will be docked in portrait orientation, but it must be opened and closed explicitly in landscape orientation |
| OPEN_GESTURE_DRAG_CONTENT: String |
static
A drawer will open by dragging the content from any location in the appropriate direction |
| OPEN_GESTURE_DRAG_CONTENT_EDGE: String |
static
A drawer will open by dragging the content starting from a certain physical distance (in inches) from the nearest edge of the content |
| OPEN_GESTURE_NONE: String |
static
The drawers container will only open using the toggle event types dispatched by the content |
| SCREEN_NAVIGATOR_CONTENT_EVENT_DISPATCHER_FIELD: String |
static
The field used to access the "content event dispatcher" of a ScreenNavigator component, which happens to be the currently active screen |
Functions
Public functions
| toggleBottomDrawer ( duration: Number = ): Void |
Opens or closes the bottom drawer |
| toggleLeftDrawer ( duration: Number = ): Void |
Opens or closes the left drawer |
| toggleRightDrawer ( duration: Number = ): Void |
Opens or closes the right drawer |
| toggleTopDrawer ( duration: Number = ): Void |
Opens or closes the top drawer |
Protected functions
Constructor
Drawers ( content: DisplayObject = null )
Constructor.
Attributes
autoSizeMode: String
The default value is Drawers.AUTO_SIZE_MODE_STAGE
Determines how the drawers container will set its own size when its dimensions (width and height) aren't set explicitly.
In the following example, the drawers container will be sized to match its content:
drawers.autoSizeMode = Drawers.AUTO_SIZE_MODE_CONTENT;
See also:
#AUTO_SIZE_MODE_STAGE
#AUTO_SIZE_MODE_CONTENT
base: DisplayObject
Inherited from DisplayObject
read-only
The topmost object in the display tree the object is part of.
blendEnabled: Boolean
Inherited from DisplayObject
Enables or disables blending. If set to false, there will be no blending and there may be performance gains.
blendMode: BlendMode
Inherited from DisplayObject
The default value is BlendMode.AUTO
The blend mode determines how the object is blended with the objects underneath.
See also:
loom2d.display.BlendMode
bottomDrawer: DisplayObject
The default value is null
The drawer that appears below the primary content.
In the following example, a List is added as the bottom drawer:
var list:List = new List(); // set data provider and other properties here drawers.bottomDrawer = list;
See also:
#bottomDrawerDockMode
#bottomDrawerToggleEventType
bottomDrawerDockMode: String
The default value is Drawers.DOCK_MODE_NONE
Determines if the bottom drawer is docked in all, some, or no stage orientations. The current stage orientation is determined by calculating the aspect ratio of the stage.
In the following example, the bottom drawer is docked in the landscape stage orientation:
drawers.bottomDrawerDockMode = Drawers.DOCK_MODE_LANDSCAPE;
See also:
#bottomDrawer
bottomDrawerToggleEventType: String
The default value is null
When this event is dispatched by the content event dispatcher, the bottom drawer will toggle open and closed.
In the following example, the bottom drawer is toggled when the content dispatches an event of type Event.OPEN:
drawers.bottomDrawerToggleEventType = Event.OPEN;
See also:
#content
#bottomDrawer
bounds: Rectangle
Inherited from DisplayObject
read-only
The bounds of the object relative to the local coordinates of the parent.
cacheAsBitmap: Boolean
Inherited from DisplayObject
If true, the untransformed contents get cached into a texture at render time.
The contents remain static until you turn off caching or use invalidateBitmapCache
to update the cache manually.
clipDrawers: Boolean
The default value is true
Determines if the drawers are clipped while opening or closing. If the content does not have a background, the drawers should generally be clipped so that the drawer does not show under the content. If the content has a fully opaque background that will conceal the drawers, then clipping may be disabled to potentially improve performance.
In the following example, clipping will be disabled:
navigator.clipDrawers = false;
See also:
#topDrawer
#rightDrawer
#bottomDrawer
#leftDrawer
content: DisplayObject
The default value is null
The primary content displayed in the center of the container.
If the primary content is a container where you'd prefer to listen to events from its children, you may need to use properties like contentEventDispatcherField, contentEventDispatcherFunction, and contentEventDispatcherChangeEventType to ensure that open and close events for drawers are correctly mapped to the correct event dispatcher. If the content is dispatching the events, then those properties should be set to null.
In the following example, a ScreenNavigator is added as the content:
var navigator:ScreenNavigator = new ScreenNavigator(); // additional code to add the screens can go here drawers.content = navigator;
See also:
#contentEventDispatcherField
#contentEventDispatcherFunction
#contentEventDispatcherChangeEventType
contentEventDispatcherChangeEventType: String
The default value is null
The event dispatched by the content to indicate that the content event dispatcher has changed. When this event is dispatched by the content, the drawers container will listen for the drawer toggle events from the new dispatcher that discovered using contentEventDispatcherField or contentEventDispatcherFunction.
For a ScreenNavigator component, this value is automatically set to Event.CHANGE.
In the following example, the drawers container will update its content event dispatcher when the content dispatches an event of type Event.CHANGE:
drawers.contentEventDispatcherChangeEventType = Event.CHANGE;
See also:
#contentEventDispatcherField
#contentEventDispatcherFunction
contentEventDispatcherField: String
The default value is null
A property of the content that references an event dispatcher that dispatches events to toggle drawers open and closed.
For a ScreenNavigator component, this value is automatically set to "activeScreen" to listen for events from the currently active/visible screen.
In the following example, the content event dispatcher field is customized:
drawers.contentEventDispatcherField = "selectedChild";
See also:
#contentEventDispatcherFunction
#contentEventDispatcherChangeEventType
#topDrawerToggleEventType
#rightDrawerToggleEventType
#bottomDrawerToggleEventType
#leftDrawerToggleEventType
contentEventDispatcherFunction: Function
The default value is null
A function that returns an event dispatcher that dispatches events to toggle drawers open and closed.
The function is expected to have the following signature:
function( content:DisplayObject ):EventDispatcher
In the following example, the content event dispatcher function is customized:
drawers.contentEventDispatcherField = function( content:CustomView ):void { return content.selectedChild; };
See also:
#contentEventDispatcherField
#contentEventDispatcherChangeEventType
#topDrawerToggleEventType
#rightDrawerToggleEventType
#bottomDrawerToggleEventType
#leftDrawerToggleEventType
defaultTextEditorFactory: Function
Inherited from FeathersControl
static
A function used by all UI controls that support text editor to
create an ITextEditor instance. You may replace the
default function with your own, if you prefer not to use the
StageTextTextEditor.
The function is expected to have the following signature:
function():ITextEditor
See also:
http://wiki.starling-framework.org/feathers/text-editors
feathers.core.ITextEditor
defaultTextRendererFactory: Function
Inherited from FeathersControl
static
A function used by all UI controls that support text renderers to create an ITextRenderer instance. You may replace the default function with your own, if you prefer not to use the BitmapFontTextRenderer.
The function is expected to have the following signature:
function():ITextRenderer
See also:
http://wiki.starling-framework.org/feathers/text-renderers
feathers.core.ITextRenderer
depth: Number
Inherited from DisplayObject
If depthSort is enabled on parent, this will be used to establish draw order. Higher values are drawn closer. Matching values have undefined order.
depthSort: Boolean
Inherited from DisplayObjectContainer
If depth sorting enabled, direct children will use their depth property to establish draw order.
focusIndicatorSkin: DisplayObject
Inherited from FeathersControl
If this component supports focus, this optional skin will be
displayed above the component when showFocus() is
called. The focus indicator skin is not always displayed when the
component has focus. Typically, if the component receives focus from
a touch, the focus indicator is not displayed.
The touchable of this skin will always be set to
false so that it does not "steal" touches from the
component or its sub-components. This skin will not affect the
dimensions of the component or its hit area. It is simply a visual
indicator of focus.
focusManager: IFocusManager
Inherited from FeathersControl
The current focus manager for this component.
focusPadding: Number
Inherited from FeathersControl
Quickly sets all focus padding properties to the same value. The
focusPadding getter always returns the value of
focusPaddingTop, but the other focus padding values may
be different.
The following example gives the button 2 pixels of focus padding on all sides:
object.padding = 2;
focusPaddingBottom: Number
Inherited from FeathersControl
The minimum space, in pixels, between the object's bottom edge and the bottom edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.
The following example gives the focus indicator skin -2 pixels of padding on the bottom edge only:
button.focusPaddingBottom = -2;
focusPaddingLeft: Number
Inherited from FeathersControl
The minimum space, in pixels, between the object's left edge and the left edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.
The following example gives the focus indicator skin -2 pixels of padding on the right edge only:
button.focusPaddingLeft = -2;
focusPaddingRight: Number
Inherited from FeathersControl
The minimum space, in pixels, between the object's right edge and the right edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.
The following example gives the focus indicator skin -2 pixels of padding on the right edge only:
button.focusPaddingRight = -2;
focusPaddingTop: Number
Inherited from FeathersControl
The minimum space, in pixels, between the object's top edge and the top edge of the focus indicator skin. A negative value may be used to expand the focus indicator skin outside the bounds of the object.
The following example gives the focus indicator skin -2 pixels of padding on the top edge only:
button.focusPaddingTop = -2;
hasVisibleArea: Boolean
Inherited from DisplayObject
read-only
Indicates if an object occupies any visible area. (Which is the case when its 'alpha', 'scaleX' and 'scaleY' values are not zero, and its 'visible' property is enabled.)
ignoreHitTestAlpha: Boolean
Inherited from DisplayObject
This can be used if you wish to have a DisplayObject with zero alpha still respond to hit tests
includeInLayout: Boolean
Inherited from FeathersControl
Determines if the ILayout should use this object or ignore it.
isBottomDrawerDocked: Boolean
read-only
Indicates if the bottom drawer is currently docked. Docking behavior of the bottom drawer is controlled with the bottomDrawerDockMode property. To check if the bottom drawer is open, but not docked, use the isBottomDrawerOpen property.
See also:
#bottomDrawer
#bottomDrawerDockMode
#isBottomDrawerOpen
isBottomDrawerOpen: Boolean
The default value is false
Indicates if the bottom drawer is currently open. If you want to check if the bottom drawer is docked, check isBottomDrawerDocked instead.
To animate the bottom drawer open or closed, call toggleBottomDrawer(). Setting isBottomDrawerOpen will open or close the bottom drawer without animation.
In the following example, we check if the bottom drawer is open:
if( drawers.isBottomDrawerOpen ) { // do something }
See also:
#bottomDrawer
#isBottomDrawerOpen
#toggleBottomDrawer()
isEnabled: Boolean
Inherited from FeathersControl
Indicates whether the control is interactive or not.
isFocusEnabled: Boolean
Inherited from FeathersControl
Determines if this component can receive focus.
isInitialized: Boolean
Inherited from FeathersControl
read-only
Determines if the component has been initialized yet. The
initialize() function is called one time only, when the
Feathers UI control is added to the display list for the first time.
isLeftDrawerDocked: Boolean
read-only
Indicates if the left drawer is currently docked. Docking behavior of the left drawer is controlled with the leftDrawerDockMode property. To check if the left drawer is open, but not docked, use the isLeftDrawerOpen property.
See also:
#leftDrawer
#leftDrawerDockMode
#isLeftDrawerOpen
isLeftDrawerOpen: Boolean
The default value is false
Indicates if the left drawer is currently open. If you want to check if the left drawer is docked, check isLeftDrawerDocked instead.
To animate the left drawer open or closed, call toggleLeftDrawer(). Setting isLeftDrawerOpen will open or close the left drawer without animation.
In the following example, we check if the left drawer is open:
if( drawers.isLeftDrawerOpen ) { // do something }
See also:
#leftDrawer
#isLeftDrawerDocked
#toggleLeftDrawer()
isQuickHitAreaEnabled: Boolean
Inherited from FeathersControl
Similar to mouseChildren on the classic display list. If true, children cannot dispatch touch events, but hit tests will be much faster.
isRightDrawerDocked: Boolean
read-only
Indicates if the right drawer is currently docked. Docking behavior of the right drawer is controlled with the rightDrawerDockMode property. To check if the right drawer is open, but not docked, use the isRightDrawerOpen property.
See also:
#rightDrawer
#rightDrawerDockMode
#isRightDrawerOpen
isRightDrawerOpen: Boolean
The default value is false
Indicates if the right drawer is currently open. If you want to check if the right drawer is docked, check isRightDrawerDocked instead.
To animate the right drawer open or closed, call toggleRightDrawer(). Setting isRightDrawerOpen will open or close the right drawer without animation.
In the following example, we check if the right drawer is open:
if( drawers.isRightDrawerOpen ) { // do something }
See also:
#rightDrawer
#rightDrawerDockMode
#toggleRightDrawer()
isTopDrawerDocked: Boolean
read-only
Indicates if the top drawer is currently docked. Docking behavior of the top drawer is controlled with the topDrawerDockMode property. To check if the top drawer is open, but not docked, use the isTopDrawerOpen property.
See also:
#topDrawer
#topDrawerDockMode
#isTopDrawerOpen
isTopDrawerOpen: Boolean
The default value is false
Indicates if the top drawer is currently open. If you want to check if the top drawer is docked, check isTopDrawerDocked instead.
To animate the top drawer open or closed, call toggleTopDrawer(). Setting isTopDrawerOpen will open or close the top drawer without animation.
In the following example, we check if the top drawer is open:
if( drawers.isTopDrawerOpen ) { // do something }
See also:
#isTopDrawerDocked
#topDrawer
#toggleTopDrawer()
layoutData: ILayoutData
Inherited from FeathersControl
Extra parameters associated with this display object that will be used by the layout algorithm.
leftDrawer: DisplayObject
The default value is null
The drawer that appears below the primary content.
In the following example, a List is added as the left drawer:
var list:List = new List(); // set data provider and other properties here drawers.leftDrawer = list;
leftDrawerDockMode: String
The default value is Drawers.DOCK_MODE_NONE
Determines if the left drawer is docked in all, some, or no stage orientations. The current stage orientation is determined by calculating the aspect ratio of the stage.
In the following example, the left drawer is docked in the landscape stage orientation:
drawers.leftDrawerDockMode = Drawers.DOCK_MODE_LANDSCAPE;
See also:
#leftDrawer
leftDrawerToggleEventType: String
The default value is null
When this event is dispatched by the content event dispatcher, the left drawer will toggle open and closed.
In the following example, the left drawer is toggled when the content dispatches and event of type Event.OPEN:
drawers.leftDrawerToggleEventType = Event.OPEN;
See also:
#content
#leftDrawer
maxHeight: Number
Inherited from FeathersControl
The maximum recommended height to be used for self-measurement and,
optionally, by any code that is resizing this component. This value
is not strictly enforced in all cases. An explicit height value that
is larger than maxHeight may be set and will not be
affected by the maximum.
maxWidth: Number
Inherited from FeathersControl
The maximum recommended width to be used for self-measurement and,
optionally, by any code that is resizing this component. This value
is not strictly enforced in all cases. An explicit width value that
is larger than maxWidth may be set and will not be
affected by the maximum.
minHeight: Number
Inherited from FeathersControl
The minimum recommended height to be used for self-measurement and,
optionally, by any code that is resizing this component. This value
is not strictly enforced in all cases. An explicit height value that
is smaller than minHeight may be set and will not be
affected by the minimum.
minTouchHeight: Number
Inherited from FeathersControl
If using isQuickHitAreaEnabled, and the hit area's
height is smaller than this value, it will be expanded.
minTouchWidth: Number
Inherited from FeathersControl
If using isQuickHitAreaEnabled, and the hit area's
width is smaller than this value, it will be expanded.
minWidth: Number
Inherited from FeathersControl
The minimum recommended width to be used for self-measurement and,
optionally, by any code that is resizing this component. This value
is not strictly enforced in all cases. An explicit width value that
is smaller than minWidth may be set and will not be
affected by the minimum.
minimumDragDistance: Number
The default value is 0.04
The minimum physical distance (in inches) that a touch must move before a drag gesture begins.
In the following example, the minimum drag distance is customized:
scroller.minimumDragDistance = 0.1;
minimumDrawerThrowVelocity: Number
The default value is 5
The minimum physical velocity (in inches per second) that a touch must move before the a drawern can be "thrown" to open or close it. Otherwise, it will settle open or closed based on which state is closer when the touch ends.
In the following example, the minimum drawer throw velocity is customized:
scroller.minimumDrawerThrowVelocity = 2;
name: String
Inherited from DisplayObject
The name of the display object (default: null). Used by 'getChildByName()' of display object containers.
nameList: TokenList
Inherited from FeathersControl
read-only
Contains a list of all "names" assigned to this control. Names are
like classes in CSS selectors. They are a non-unique identifier that
can differentiate multiple styles of the same type of UI control. A
single control may have many names, and many controls can share a
single name. Names may be added, removed, or toggled on the nameList.
See also:
#name
nextTabFocus: IFocusDisplayObject
Inherited from FeathersControl
The next object that will receive focus when the tab key is pressed.
If null, defaults to the next child on the display list.
numChildren: Number
Inherited from DisplayObjectContainer
read-only
The number of children of this container.
openGesture: String
The default value is Drawers.OPEN_GESTURE_DRAG_CONTENT_EDGE
An optional touch gesture used to open a drawer.
In the following example, the drawers are opened by dragging anywhere inside the content:
drawers.openGesture = Drawers.OPEN_GESTURE_DRAG_CONTENT;
See also:
#OPEN_GESTURE_NONE
#OPEN_GESTURE_DRAG_CONTENT
#OPEN_GESTURE_DRAG_CONTENT_EDGE
openGestureEdgeSize: Number
The default value is 0.1
The minimum physical distance (in inches) that a touch must move before a drag gesture begins.
In the following example, the open gesture edge size customized:
scroller.openGestureEdgeSize = 0.25;
openOrCloseDuration: Number
The default value is 0.25
The duration, in seconds, of the animation when a drawer opens or closes.
In the following example, the duration of the animation that opens or closes a drawer is set to 500 milliseconds:
scroller.openOrCloseDuration = 0.5;
See also:
#openOrCloseEase
openOrCloseEase: Object
The default value is starling.animation.Transitions.EASE_OUT
The easing function used for opening or closing the drawers.
In the following example, the ease of the animation that opens and closes a drawer is customized:
drawrs.openOrCloseEase = Transitions.EASE_IN_OUT;
See also:
starling.animation.Transitions
#openOrCloseDuration
parent: DisplayObjectContainer
Inherited from DisplayObject
pivotX: Number
Inherited from DisplayObject
The x coordinate of the object's origin in its own coordinate space (default: 0).
pivotY: Number
Inherited from DisplayObject
The y coordinate of the object's origin in its own coordinate space (default: 0).
previousTabFocus: IFocusDisplayObject
Inherited from FeathersControl
The previous object that will receive focus when the tab key is
pressed while holding shift. If null, defaults to the
previous child on the display list.
rightDrawer: DisplayObject
The default value is null
The drawer that appears to the right of the primary content.
In the following example, a List is added as the right drawer:
var list:List = new List(); // set data provider and other properties here drawers.rightDrawer = list;
rightDrawerDockMode: String
The default value is Drawers.DOCK_MODE_NONE
Determines if the right drawer is docked in all, some, or no stage orientations. The current stage orientation is determined by calculating the aspect ratio of the stage.
In the following example, the right drawer is docked in the landscape stage orientation:
drawers.rightDrawerDockMode = Drawers.DOCK_MODE_LANDSCAPE;
See also:
#rightDrawer
rightDrawerToggleEventType: String
The default value is null
When this event is dispatched by the content event dispatcher, the right drawer will toggle open and closed.
In the following example, the right drawer is toggled when the content dispatches an event of type Event.OPEN:
drawers.rightDrawerToggleEventType = Event.OPEN;
See also:
#content
#rightDrawer
root: DisplayObject
Inherited from DisplayObject
read-only
The root object the display object is connected to (ie: an instance of the class that was passed to the Starling constructor), or null if the object is not connected to the stage.
rotation: Number
Inherited from DisplayObject
The rotation of the object in radians, (In Loom2D, all angles are measured in radians.)
scale: Number
Inherited from DisplayObject
General scale factor. '1' means no scale, negative values flip the object. Use this when setting scaleX/scaleY explicitly is too verbose.
scaleX: Number
Inherited from DisplayObject
The horizontal scale factor. '1' means no scale, negative values flip the object.
scaleY: Number
Inherited from DisplayObject
The vertical scale factor. '1' means no scale, negative values flip the object.
stage: Stage
Inherited from DisplayObject
read-only
The stage the display object is connected to, or null if it is not connected to the stage.
topDrawer: DisplayObject
The default value is null
The drawer that appears above the primary content.
In the following example, a List is added as the top drawer:
var list:List = new List(); // set data provider and other properties here drawers.topDrawer = list;
See also:
#topDrawerDockMode
#topDrawerToggleEventType
topDrawerDockMode: String
The default value is Drawers.DOCK_MODE_NONE
Determines if the top drawer is docked in all, some, or no stage orientations. The current stage orientation is determined by calculating the aspect ratio of the stage.
In the following example, the top drawer is docked in the landscape stage orientation:
drawers.topDrawerDockMode = Drawers.DOCK_MODE_LANDSCAPE;
See also:
#topDrawer
topDrawerToggleEventType: String
The default value is null
When this event is dispatched by the content event dispatcher, the top drawer will toggle open and closed.
In the following example, the top drawer is toggled when the content dispatches an event of type Event.OPEN:
drawers.topDrawerToggleEventType = Event.OPEN;
See also:
#content
#topDrawer
touchable: Boolean
Inherited from DisplayObject
Indicates if this object (and its children) will receive touch events.
transformationMatrix: Matrix
Inherited from DisplayObject
The transformation matrix of the object relative to its parent.
If you assign a custom transformation matrix, Starling will try to figure out
suitable values for x, y, scaleX, scaleY, and rotation.
However, if the matrix was created in a different way, this might not be possible.
In that case, Starling will apply the matrix, but not update the corresponding
properties.
visible: Boolean
Inherited from DisplayObject
The visibility of the object, An invisible object will be untouchable.
x: Number
Inherited from DisplayObject
The x coordinate of the object relative to the local coordinates of the parent.
y: Number
Inherited from DisplayObject
The y coordinate of the object relative to the local coordinates of the parent.
Protected attributes
Constants
AUTO_SIZE_MODE_CONTENT: String
static
The drawers container will auto size itself to fit its content.
See also:
#autoSizeMode
AUTO_SIZE_MODE_STAGE: String
static
The drawers container will auto size itself to fill the entire stage.
See also:
#autoSizeMode
DOCK_MODE_BOTH: String
static
The drawer will be docked in all orientations.
See also:
#topDrawerDockMode
#rightDrawerDockMode
#bottomDrawerDockMode
#leftDrawerDockMode
#isTopDrawerDocked
#isRightDrawerDocked
#isBottomDrawerDocked
#isLeftDrawerDocked
DOCK_MODE_LANDSCAPE: String
static
The drawer will be docked in landscape orientation, but it must be opened and closed explicitly in portrait orientation.
See also:
#topDrawerDockMode
#rightDrawerDockMode
#bottomDrawerDockMode
#leftDrawerDockMode
#isTopDrawerDocked
#isRightDrawerDocked
#isBottomDrawerDocked
#isLeftDrawerDocked
DOCK_MODE_NONE: String
static
The drawer won't be docked in any orientation. It must be opened and closed explicitly in all orientations.
See also:
#topDrawerDockMode
#rightDrawerDockMode
#bottomDrawerDockMode
#leftDrawerDockMode
#isTopDrawerDocked
#isRightDrawerDocked
#isBottomDrawerDocked
#isLeftDrawerDocked
DOCK_MODE_PORTRAIT: String
static
The drawer will be docked in portrait orientation, but it must be opened and closed explicitly in landscape orientation.
See also:
#topDrawerDockMode
#rightDrawerDockMode
#bottomDrawerDockMode
#leftDrawerDockMode
#isTopDrawerDocked
#isRightDrawerDocked
#isBottomDrawerDocked
#isLeftDrawerDocked
INVALIDATION_FLAG_ALL: String
static
Flag to indicate that everything is invalid and should be redrawn.
INVALIDATION_FLAG_DATA: String
static
Invalidation flag to indicate that the primary data displayed by the UI control has changed.
INVALIDATION_FLAG_FOCUS: String
static
Invalidation flag to indicate that the focus of the UI control has changed.
INVALIDATION_FLAG_LAYOUT: String
static
Invalidation flag to indicate that the layout of the UI control has changed.
INVALIDATION_FLAG_SCROLL: String
static
Invalidation flag to indicate that the scroll position of the UI control has changed.
INVALIDATION_FLAG_SELECTED: String
static
Invalidation flag to indicate that the selection of the UI control has changed.
INVALIDATION_FLAG_SIZE: String
static
Invalidation flag to indicate that the dimensions of the UI control have changed.
INVALIDATION_FLAG_SKIN: String
static
Invalidation flag to indicate that the skin of the UI control has changed.
INVALIDATION_FLAG_STATE: String
static
Invalidation flag to indicate that the state has changed. Used by
isEnabled, but may be used for other control states too.
See also:
#isEnabled
INVALIDATION_FLAG_STYLES: String
static
Invalidation flag to indicate that the styles or visual appearance of the UI control has changed.
OPEN_GESTURE_DRAG_CONTENT: String
static
A drawer will open by dragging the content from any location in the appropriate direction.
See also:
#openGesture
OPEN_GESTURE_DRAG_CONTENT_EDGE: String
static
A drawer will open by dragging the content starting from a certain physical distance (in inches) from the nearest edge of the content. To customize this distance, use the openGestureDragContentEdgeDistance property.
See also:
#openGesture
openGestureEdgeSize
OPEN_GESTURE_NONE: String
static
The drawers container will only open using the toggle event types dispatched by the content. No gesture can be used to open a drawer.
See also:
#openGesture
#topDrawerToggleEventType
#rightDrawerToggleEventType
#bottomDrawerToggleEventType
#leftDrawerToggleEventType
SCREEN_NAVIGATOR_CONTENT_EVENT_DISPATCHER_FIELD: String
static
The field used to access the "content event dispatcher" of a ScreenNavigator component, which happens to be the currently active screen.
See also:
#contentEventDispatcherField
feathers.controls.ScreenNavigator
Functions
FeathersControl__ls_staticconstructor
(): Void
Inherited from FeathersControl
static
Static constructor.
addChild
(
child: DisplayObject
,
fireEvents: Boolean
= true
): DisplayObject
Inherited from DisplayObjectContainer
Adds a child to the container. It will be at the frontmost position.
Parameters
| child: DisplayObject | |
| fireEvents: Boolean = true |
addChildAt
(
child: DisplayObject
,
index: Number
,
fireEvents: Boolean
= true
): DisplayObject
Inherited from DisplayObjectContainer
Adds a child to the container at a certain index.
Parameters
| child: DisplayObject | |
| index: Number | |
| fireEvents: Boolean = true |
addEventListener
(
type: String
,
listener: Function
): Void
Inherited from EventDispatcher
Registers an event listener at a certain object.
Parameters
| type: String | |
| listener: Function |
addLMLChild
(
id: String
,
child: Object
): Void
Inherited from DisplayObjectContainer
Add a child to this LML node, identifying it by id.
Parameters
| id: String | |
| child: Object |
broadcastEvent
(
event: Event
): Void
Inherited from DisplayObjectContainer
Dispatches an event on all children (recursively). The event must not bubble.
Parameters
| event: Event |
broadcastEventWith
(
type: String
,
data: Object
= null
): Void
Inherited from DisplayObjectContainer
Dispatches an event with the given parameters on all children (recursively). The method uses an internal pool of event objects to avoid allocations.
Parameters
| type: String | |
| data: Object = null |
center
(): Void
Inherited from DisplayObject
Center the DisplayObject's pivot point using the width and height. This centers this object about its own origin based on its width and height.
contains
(
child: DisplayObject
): Boolean
Inherited from DisplayObjectContainer
Determines if a certain object is a child of the container (recursively).
Parameters
| child: DisplayObject |
dispatchEvent
(
event: Event
): Void
Inherited from EventDispatcher
Dispatches an event to all objects that have registered listeners for its type. If an event with enabled 'bubble' property is dispatched to a display object, it will travel up along the line of parents, until it either hits the root object or someone stops its propagation manually.
Parameters
| event: Event |
dispatchEventWith
(
type: String
,
bubbles: Boolean
= false
,
data: Object
= null
): Void
Inherited from EventDispatcher
Dispatches an event with the given parameters to all objects that have registered listeners for the given type. The method uses an internal pool of event objects to avoid allocations.
Parameters
| type: String | |
| bubbles: Boolean = false | |
| data: Object = null |
dispose
(): Void
Inherited from DisplayObject
Disposes all resources of the display object. GPU buffers are released, event listeners are removed, filters are disposed.
getBounds
(
targetSpace: DisplayObject
,
resultRect: Rectangle
= null
): Rectangle
Inherited from DisplayObject
Returns a rectangle that completely encloses the object as it appears in another coordinate system. If you pass a 'resultRectangle', the result will be stored in this rectangle instead of creating a new object.
Parameters
| targetSpace: DisplayObject | |
| resultRect: Rectangle = null |
getChildAt
(
index: Number
): DisplayObject
Inherited from DisplayObjectContainer
Returns a child object at a certain index.
Parameters
| index: Number |
getChildAtUnsafe
(
index: Number
): DisplayObject
Inherited from DisplayObjectContainer
Returns a child object at a certain index without doing bounds checks. For optimized use in cases where you are 100% about the index validity.
Parameters
| index: Number |
getChildByName
(
name: String
): DisplayObject
Inherited from DisplayObjectContainer
Returns a child object with a certain name (non-recursively).
Parameters
| name: String |
getChildIndex
(
child: DisplayObject
): Number
Inherited from DisplayObjectContainer
Returns the index of a child within the container, or "-1" if it is not found.
Parameters
| child: DisplayObject |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getTargetTransformationMatrix
(
targetSpace: DisplayObject
,
resultMatrix: Matrix
): Void
Inherited from DisplayObject
native
Parameters
| targetSpace: DisplayObject | |
| resultMatrix: Matrix |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
globalToLocal
(
globalPoint: Point
): Point
Inherited from DisplayObject
Transforms a point from global (stage) coordinates to the local coordinate system.
Parameters
| globalPoint: Point |
hasEventListener
(
type: String
): Boolean
Inherited from EventDispatcher
Returns if there are listeners registered for a certain event type.
Parameters
| type: String |
hideFocus
(): Void
Inherited from FeathersControl
If the visual indicator of focus has been displayed by
showFocus(), call this function to hide it.
Important: This function will not clear focus
from the display object if it has focus. To clear focus from the
display object, you should set the focus property on
the focus manager to null or another display object.
See also:
#showFocus()
feathers.core.IFocusManager#focus
hitTest
(
localPoint: Point
,
forTouch: Boolean
= false
): DisplayObject
Inherited from DisplayObject
Returns the object that is found topmost beneath a point in local coordinates, or nil if the test fails. If "forTouch" is true, untouchable and invisible objects will cause the test to fail.
Parameters
| localPoint: Point | |
| forTouch: Boolean = false |
initializeLMLNode
(
id: String
): Void
Inherited from DisplayObject
Handle LML node initialization.
Parameters
| id: String |
invalidate
(
flag: String
=
): Void
Inherited from FeathersControl
Call this function to tell the UI control that a redraw is pending. The redraw will happen immediately before Starling renders the UI control to the screen. The validation system exists to ensure that multiple properties can be set together without redrawing multiple times in between each property change.
If you cannot wait until later for the validation to happen, you
can call validate() to redraw immediately. As an example,
you might want to validate immediately if you need to access the
correct width or height values of the UI
control, since these values are calculated during validation.
See also:
feathers.core.FeathersControl#validate()
Parameters
| flag: String = |
invalidateBitmapCache
(): Void
Inherited from DisplayObject
native
Update the cached texture before the next render.
This function has no effect if cacheAsBitmap is turned off.
isInvalid
(
flag: String
= null
): Boolean
Inherited from FeathersControl
Indicates whether the control is pending validation or not. By
default, returns true if any invalidation flag has been
set. If you pass in a specific flag, returns true only
if that flag has been set (others may be set too, but it checks the
specific flag only. If all flags have been marked as invalid, always
returns true.
Parameters
| flag: String = null |
localToGlobal
(
localPoint: Point
): Point
Inherited from DisplayObject
Transforms a point from the local coordinate system to global (stage) coordinates.
Parameters
| localPoint: Point |
moveChildLast
(
child: DisplayObject
): Void
Inherited from DisplayObjectContainer
Moves a child to be the last object in the container.
Parameters
| child: DisplayObject |
preinitializeLMLNode
(
id: String
): Void
Inherited from DisplayObject
Pre-initialize the LML node.
Parameters
| id: String |
removeChild
(
child: DisplayObject
,
dispose: Boolean
= false
,
fireEvents: Boolean
= true
): DisplayObject
Inherited from DisplayObjectContainer
Removes a child from the container. If the object is not a child, nothing happens. If requested, the child will be disposed right away.
Parameters
| child: DisplayObject | |
| dispose: Boolean = false | |
| fireEvents: Boolean = true |
removeChildAt
(
index: Number
,
dispose: Boolean
= false
,
fireEvents: Boolean
= true
): DisplayObject
Inherited from DisplayObjectContainer
Removes a child at a certain index. Children above the child will move down. If requested, the child will be disposed right away.
Parameters
| index: Number | |
| dispose: Boolean = false | |
| fireEvents: Boolean = true |
removeChildren
(
beginIndex: Number
= 0
,
endIndex: Number
=
,
dispose: Boolean
= false
): Void
Inherited from DisplayObjectContainer
Removes a range of children from the container (endIndex included). If no arguments are given, all children will be removed.
Parameters
| beginIndex: Number = 0 | |
| endIndex: Number = | |
| dispose: Boolean = false |
removeEventListener
(
type: String
,
listener: Function
): Void
Inherited from EventDispatcher
Removes an event listener from the object.
Parameters
| type: String | |
| listener: Function |
removeEventListeners
(
type: String
= null
): Void
Inherited from EventDispatcher
Removes all event listeners with a certain type, or all of them if type is null. Be careful when removing all event listeners: you never know who else was listening.
Parameters
| type: String = null |
removeFromParent
(
dispose: Boolean
= false
): Void
Inherited from DisplayObject
Removes the object from its parent, if it has one.
Parameters
| dispose: Boolean = false |
removeLMLChildren
(): Void
Inherited from DisplayObjectContainer
Remove (and destroy) all LML children from this node.
setChildIndex
(
child: DisplayObject
,
index: Number
): Void
Inherited from DisplayObjectContainer
Moves a child to a certain index. Children at and after the replaced position move up.
Parameters
| child: DisplayObject | |
| index: Number |
setChildrenUnsafe
(
ordered: Vector.<DisplayObject>
): Void
Inherited from DisplayObjectContainer
Parameters
| ordered: Vector.<DisplayObject> |
setSize
(
width: Number
,
height: Number
): Void
Inherited from FeathersControl
Sets both the width and the height of the control.
Parameters
| width: Number | |
| height: Number |
showFocus
(): Void
Inherited from FeathersControl
If the object has focus, an additional visual indicator may optionally be displayed to highlight the object. Calling this function may have no effect. It's merely a suggestion to the object.
Important: This function will not give focus to
the display object if it doesn't have focus. To give focus to the
display object, you should set the focus property on
the focus manager.
object.focusManager.focus = object;
See also:
#hideFocus()
feathers.core.IFocusManager#focus
sortChildren
(
compareFunction: Function
): Void
Inherited from DisplayObjectContainer
Sorts the children according to a given function (that works just like the sort function of the Vector class).
Parameters
| compareFunction: Function |
swapChildren
(
child1: DisplayObject
,
child2: DisplayObject
): Void
Inherited from DisplayObjectContainer
Swaps the indexes of two children.
Parameters
| child1: DisplayObject | |
| child2: DisplayObject |
swapChildrenAt
(
index1: Number
,
index2: Number
): Void
Inherited from DisplayObjectContainer
Swaps the indexes of two children.
Parameters
| index1: Number | |
| index2: Number |
toString
(): String
Inherited from Object
native
Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().
Returns
| String | String that described the Object. |
toggleBottomDrawer ( duration: Number = ): Void
Opens or closes the bottom drawer. If the duration argument is NaN, the default openOrCloseDuration is used. The default value of the duration argument is NaN. Otherwise, this value is the duration of the animation, in seconds.
To open or close the bottom drawer without animation, set the isBottomDrawerOpen property.
See also:
#isBottomDrawerOpen
#openOrCloseDuration
#openOrCloseEase
Parameters
| duration: Number = |
toggleLeftDrawer ( duration: Number = ): Void
Opens or closes the left drawer. If the duration argument is NaN, the default openOrCloseDuration is used. The default value of the duration argument is NaN. Otherwise, this value is the duration of the animation, in seconds.
To open or close the left drawer without animation, set the isLeftDrawerOpen property.
See also:
#isLeftDrawerOpen
#openOrCloseDuration
#openOrCloseEase
Parameters
| duration: Number = |
toggleRightDrawer ( duration: Number = ): Void
Opens or closes the right drawer. If the duration argument is NaN, the default openOrCloseDuration is used. The default value of the duration argument is NaN. Otherwise, this value is the duration of the animation, in seconds.
To open or close the right drawer without animation, set the isRightDrawerOpen property.
See also:
#isRightDrawerOpen
#openOrCloseDuration
#openOrCloseEase
Parameters
| duration: Number = |
toggleTopDrawer ( duration: Number = ): Void
Opens or closes the top drawer. If the duration argument is NaN, the default openOrCloseDuration is used. The default value of the duration argument is NaN. Otherwise, this value is the duration of the animation, in seconds.
To open or close the top drawer without animation, set the isTopDrawerOpen property.
See also:
#isTopDrawerOpen
#openOrCloseDuration
#openOrCloseEase
Parameters
| duration: Number = |