| Package | feathers.core |
| Class | public class DisplayListWatcher |
| Inheritance | DisplayListWatcher Object |
| Subclasses | AddedWatcher, MinimalTheme |
In the example below, the buttonInitializer() function
will be called when a Button is added to the display list:
setInitializerForClass(Button, buttonInitializer);However, initializers are not called for subclasses. If a
Check is added to the display list (Check
extends Button), the buttonInitializer()
function will not be called. This important restriction allows subclasses
to have different skins, for instance.
You can target a specific subclass with the same initializer function without adding it for all subclasses:
setInitializerForClass(Button, buttonInitializer);
setInitializerForClass(Check, buttonInitializer);In this case, Button and Check will trigger
the buttonInitializer() function, but Radio
(another subclass of Button) will not.
You can target a class and all of its subclasses, using a different function. This is recommended only when you are absolutely sure that no subclasses will need a separate initializer.
setInitializerForClassAndSubclasses(Button, buttonInitializer);In this case, Button, Check, Radio
and every other subclass of Button (including any subclasses
that you create yourself) will trigger the buttonInitializer()
function.
| Property | Defined By | ||
|---|---|---|---|
| initializeOnce : Boolean
Determines if objects added to the display list are initialized only
once or every time that they are re-added. | DisplayListWatcher | ||
| processRecursively : Boolean = true
Determines if only the object added should be processed or if its
children should be processed recursively. | DisplayListWatcher | ||
| requiredBaseClass : Class
The minimum base class required before the AddedWatcher will check
to see if a particular display object has any initializers. | DisplayListWatcher | ||
| Property | Defined By | ||
|---|---|---|---|
| root : DisplayObjectContainer
The root of the display list that is watched for added children. | DisplayListWatcher | ||
| Method | Defined By | ||
|---|---|---|---|
DisplayListWatcher(topLevelContainer:DisplayObjectContainer)
Constructor. | DisplayListWatcher | ||
clearInitializerForClass(type:Class, withName:String = null):void
If an initializer exists for a specific class, it will be removed
completely. | DisplayListWatcher | ||
clearInitializerForClassAndSubclasses(type:Class):void
If an initializer exists for a specific class and its subclasses, the
initializer will be removed completely. | DisplayListWatcher | ||
dispose():void
Stops listening to the root and cleans up anything else that needs to
be disposed. | DisplayListWatcher | ||
getInitializerForClass(type:Class, withName:String = null):Function
If an initializer exists for a specific class, it will be returned. | DisplayListWatcher | ||
getInitializerForClassAndSubclasses(type:Class):Function
If an initializer exists for a specific class and its subclasses, the initializer will be returned. | DisplayListWatcher | ||
setInitializerForClass(type:Class, initializer:Function, withName:String = null):void
Sets the initializer for a specific class. | DisplayListWatcher | ||
setInitializerForClassAndSubclasses(type:Class, initializer:Function):void
Sets an initializer for a specific class and any subclasses. | DisplayListWatcher | ||
| initializeOnce | property |
initializeOnce:BooleanDetermines if objects added to the display list are initialized only once or every time that they are re-added.
public function get initializeOnce():Boolean public function set initializeOnce(value:Boolean):void| processRecursively | property |
public var processRecursively:Boolean = trueDetermines if only the object added should be processed or if its children should be processed recursively.
| requiredBaseClass | property |
public var requiredBaseClass:ClassThe minimum base class required before the AddedWatcher will check to see if a particular display object has any initializers.
| root | property |
protected var root:DisplayObjectContainerThe root of the display list that is watched for added children.
| DisplayListWatcher | () | Constructor |
public function DisplayListWatcher(topLevelContainer:DisplayObjectContainer)Constructor.
ParameterstopLevelContainer:DisplayObjectContainer — The root display object to watch (not necessarily Starling's root object)
|
| clearInitializerForClass | () | method |
public function clearInitializerForClass(type:Class, withName:String = null):voidIf an initializer exists for a specific class, it will be removed completely.
Parameters
type:Class | |
withName:String (default = null) |
| clearInitializerForClassAndSubclasses | () | method |
public function clearInitializerForClassAndSubclasses(type:Class):voidIf an initializer exists for a specific class and its subclasses, the initializer will be removed completely.
Parameters
type:Class |
| dispose | () | method |
public function dispose():void
Stops listening to the root and cleans up anything else that needs to
be disposed. If a DisplayListWatcher is extended for a
theme, it should also dispose textures and other assets.
| getInitializerForClass | () | method |
public function getInitializerForClass(type:Class, withName:String = null):FunctionIf an initializer exists for a specific class, it will be returned.
Parameters
type:Class | |
withName:String (default = null) |
Function |
| getInitializerForClassAndSubclasses | () | method |
public function getInitializerForClassAndSubclasses(type:Class):FunctionIf an initializer exists for a specific class and its subclasses, the initializer will be returned.
Parameters
type:Class |
Function |
| setInitializerForClass | () | method |
public function setInitializerForClass(type:Class, initializer:Function, withName:String = null):voidSets the initializer for a specific class.
Parameters
type:Class | |
initializer:Function | |
withName:String (default = null) |
| setInitializerForClassAndSubclasses | () | method |
public function setInitializerForClassAndSubclasses(type:Class, initializer:Function):voidSets an initializer for a specific class and any subclasses. This option can potentially hurt performance, so use sparingly.
Parameters
type:Class | |
initializer:Function |