| Package | feathers.controls |
| Class | public class ScreenNavigatorItem |
| Inheritance | ScreenNavigatorItem Object |
| Implements | feathers.controls.supportClasses.IScreenNavigatorItem |
| Product Version : | Feathers 1.0.0 |
ScreenNavigator component.
The following example creates a new ScreenNavigatorItem
using the SettingsScreen class to instantiate the screen
instance. When the screen is shown, its settings property
will be set. When the screen instance dispatches
Event.COMPLETE, the ScreenNavigator will
navigate to a screen with the ID "mainMenu".
var settingsData:Object = { volume: 0.8, difficulty: "hard" };
var item:ScreenNavigatorItem = new ScreenNavigatorItem( SettingsScreen );
item.properties.settings = settingsData;
item.setScreenIDForEvent( Event.COMPLETE, "mainMenu" );
navigator.addScreen( "settings", item );See also
| Property | Defined By | ||
|---|---|---|---|
| canDispose : Boolean [read-only]
Determines if a display object returned by getScreen()
can be disposed or not when a screen is no longer active. | ScreenNavigatorItem | ||
| events : Object
A set of key-value pairs representing actions that should be
triggered when events are dispatched by the screen when it is shown. | ScreenNavigatorItem | ||
| properties : Object
A set of key-value pairs representing properties to be set on the
screen when it is shown. | ScreenNavigatorItem | ||
| screen : Object
The screen to be displayed by the ScreenNavigator. | ScreenNavigatorItem | ||
| transitionDelayEvent : String
An optional event that the screen will dispatch when it's ready for
the transition to start. | ScreenNavigatorItem | ||
| Method | Defined By | ||
|---|---|---|---|
ScreenNavigatorItem(screen:Object = null, events:Object = null, properties:Object = null)
Constructor. | ScreenNavigatorItem | ||
clearEvent(eventType:String):void
Cancels the action previously registered to be triggered when the
screen dispatches an event. | ScreenNavigatorItem | ||
getScreen():DisplayObject
Returns a display object instance of this screen. | ScreenNavigatorItem | ||
setFunctionForEvent(eventType:String, action:Function):void
Specifies a function to call when an event is dispatched by the
screen. | ScreenNavigatorItem | ||
setScreenIDForEvent(eventType:String, screenID:String):void
Specifies another screen to navigate to when an event is dispatched
by this screen. | ScreenNavigatorItem | ||
| canDispose | property |
canDispose:Boolean [read-only]
Determines if a display object returned by getScreen()
can be disposed or not when a screen is no longer active.
public function get canDispose():Boolean| events | property |
events:Object
A set of key-value pairs representing actions that should be
triggered when events are dispatched by the screen when it is shown.
A pair's key is the event type to listen for (or the property name of
an ISignal instance), and a pair's value is one of two
possible types. When this event is dispatched, and a pair's value
is a String, the ScreenNavigator will show
another screen with an ID equal to the string value. When this event
is dispatched, and the pair's value is a Function, the
function will be called as if it were a listener for the event.
public function get events():Object public function set events(value:Object):voidSee also
| properties | property |
properties:ObjectA set of key-value pairs representing properties to be set on the screen when it is shown. A pair's key is the name of the screen's property, and a pair's value is the value to be passed to the screen's property.
public function get properties():Object public function set properties(value:Object):void| screen | property |
screen:Object
The screen to be displayed by the ScreenNavigator. It
may be one of several possible types:
Class that may be instantiated to create a DisplayObjectFunction that returns a DisplayObjectDisplayObject that is already instantiatedIf the screen is a Class or a Function,
a new instance of the screen will be instantiated every time that it
is shown by the ScreenNavigator. The screen's state
will not be saved automatically. The screen's state may be saved in
properties, if needed.
If the screen is a DisplayObject, the same instance
will be reused every time that it is shown by the
ScreenNavigator. When the screen is shown again, its
state will remain the same as when it was previously hidden. However,
the screen will also be kept in memory even when it isn't visible,
limiting the resources that are available for other screens.
The default value is null.
public function get screen():Object public function set screen(value:Object):void| transitionDelayEvent | property |
transitionDelayEvent:String
An optional event that the screen will dispatch when it's ready for
the transition to start. If null, the transition will
start immediately.
Useful for loading assets or doing other long tasks to prepare the screen before it is shown. It is recommended to display some kind of progress indicator over the previous screen during this delay to ensure that users don't get confused and think that the app has frozen.
public function get transitionDelayEvent():String public function set transitionDelayEvent(value:String):void| ScreenNavigatorItem | () | Constructor |
public function ScreenNavigatorItem(screen:Object = null, events:Object = null, properties:Object = null)Constructor.
Parametersscreen:Object (default = null) | |
events:Object (default = null) | |
properties:Object (default = null) |
| clearEvent | () | method |
public function clearEvent(eventType:String):voidCancels the action previously registered to be triggered when the screen dispatches an event.
Parameters
eventType:String |
See also
| getScreen | () | method |
public function getScreen():DisplayObjectReturns a display object instance of this screen.
ReturnsDisplayObject |
| setFunctionForEvent | () | method |
public function setFunctionForEvent(eventType:String, action:Function):voidSpecifies a function to call when an event is dispatched by the screen.
If the screen is currently being displayed by a
ScreenNavigator, and you call
setFunctionForEvent() on the ScreenNavigatorItem,
the ScreenNavigator won't listen for the event until
the next time that the screen is shown.
Parameters
eventType:String | |
action:Function |
See also
| setScreenIDForEvent | () | method |
public function setScreenIDForEvent(eventType:String, screenID:String):void
Specifies another screen to navigate to when an event is dispatched
by this screen. The other screen should be specified by its ID that
is registered with the ScreenNavigator.
If the screen is currently being displayed by a
ScreenNavigator, and you call
setScreenIDForEvent() on the ScreenNavigatorItem,
the ScreenNavigator won't listen for the event until the
next time that the screen is shown.
Parameters
eventType:String | |
screenID:String |
See also