| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
The AbstractLocator class gives an abstract implementation for
Locator objects.
protected var _m:HashMap
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Map storing String keys associated with
Object values.
public function AbstractLocator(type:Class = null, typeListener:Class = null, logger:Log = null)
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Creates a new locator instance. If the type
argument is defined, the locator is considered as typed, and
then the type of all elements inserted in this locator is checked.
Parameters
| type:Class (default = null) — Class type for locator elements.
|
| |
| typeListener:Class (default = null) — Class type for locator listeners.
|
| |
| logger:Log (default = null) — custom logger to output locator messages.
|
public function add(d:Dictionary):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Adds all ressources contained in the passed-in dictionnary
into this locator instance. If there is keys used both in
the locator and in the dictionnary an exception is thrown.
Parameters
| d:Dictionary — dictionnary instance which contains ressources
to be added
|
Throws
| — IllegalArgumentException — One or more
keys present in the dictionnary already exist in this
locator instance.
|
public function addEventListener(type:String, listener:Object, ... rest):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Adds an event listener for the specified event type.
There is two behaviors for the addEventListener
function :
- The passed-in listener is an object :
The object is added as listener only for the specified event, the object must
have a function with the same name than
type or at least a
handleEvent function.
- The passed-in listener is a function :
A
Delegate object is created and then
added as listener for the event type. There is no restriction on the name of
the function. If the rest is not empty, all elements in it is
used as additional arguments into the delegate object.
Parameters
| type:String — name of the event for which register the listener
|
| |
| listener:Object — object or function which will receive this event
|
| |
| ... rest — additional arguments for the function listener
|
Returns
| Boolean — true if the function have been succesfully added as
listener fot the passed-in event
|
Throws
| — UnsupportedOperationException — If the listener is an object
which have neither a function with the same name than the event type nor
a function called handleEvent
|
protected function broadcastEvent(e:Event):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Broadcast the passed-in event object to listeners
according to the event's type. The event is broadcasted
to both listeners registered specifically for this event
type and global listeners in the broadcaster.
If the target property of the passed-in event
is null, it will be set using the value of the
source property of this event broadcaster.
Parameters
| e:Event — event object to broadcast
|
public function callMethodOnAllValues(methodName:String, ... args):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Takes all values of a Locator and call on each value the method name
passed as 1st argument.
Basical example which plays all MovieClips from frame 10.
Parameters
| methodName:String — method name to call on each value stored in the locator.
|
| |
| ... args — args additionnal parameters.
|
Example
myMovieClipLocator.callMethodOnAllValues( "gotoAndPlay", 10 );
protected function getBroadcaster():Broadcaster
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns event Broadcaster owned by this locator.
Returns
| Broadcaster —
The event Broadcaster owned by this locator.
|
public function getKeys():Array
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns an Array view of the keys contained in this locator.
Returns
| Array — an array view of the keys contained in this locator
|
public function getLogger():Log
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the exclusive logger object owned by this locator.
It allow this logger to send logging message directly on
its owner logging channel.
Returns
| Log —
logger associated to the owner
|
public function getType():Class
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Return the class type of elements in this container.
An untyped container returns null, as the
wildcard type (/code>) is not a Class
and Object class doesn't fit for primitive types.
Returns
| Class — Class type of the container's elements
|
public function getValues():Array
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns an Array view of the values contained in this locator.
Returns
| Array — an array view of the values contained in this locator
|
public function isRegistered(name:String):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true is there is a ressource associated
with the passed-in key. To avoid errors when
retreiving ressources from a locator you should systematically
use the isRegistered function to check if the
ressource you would access is already accessible before any
call to the locate function.
Parameters
Returns
| Boolean — true is there is a ressource associated
with the passed-in key.
|
public function isTyped():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if this container perform a verification
of the type of elements.
Returns
| Boolean — true if this container perform a verification
of the type of elements.
|
public function locate(name:String):Object
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the ressource associated with the passed-in key.
If there is no ressource identified by the passed-in key, the
function will fail with an error. To avoid the throw of an exception
when attempting to access to a ressource, take care to check the
existence of the ressource before trying to access to it.
Parameters
| name:String — identifier of the ressource to access
|
Returns
| Object — the ressource associated with the passed-in key
|
Throws
| — NoSuchElementException — There is no ressource
associated with the passed-in key
|
public function matchType(o:*):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Verify that the passed-in object type match the current
container element's type.
Parameters
Returns
| Boolean — true if the object is elligible for this
container, either false.
|
protected function onRegister(name:String = null, o:Object = null):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Call this method to do something when an object is registered
in locator.
Parameters
| name:String (default = null) — Name of the registered object
|
| |
| o:Object (default = null) — The registered object
|
protected function onUnregister(name:String = null):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Call this method to do something when an object is unregistered
from locator.
Parameters
| name:String (default = null) — Name of the registered object
|
public function processOnAllValues(f:Function, ... args):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Takes all values of a Locator and pass them one by one as arguments
to a method of an object.
It's exactly the same concept as batch processing in audio or video
software, when you choose to run the same actions on a group of files.
Basical example which sets _alpha value to .4 and scale to 50
on all MovieClips nested in the Locator instance:
Parameters
| f:Function — function to execute on each value stored in the locator.
|
| |
| ... args — args additionnal parameters.
|
Example
function changeAlpha( mc : MovieClip, a : Number, s : Number )
{
mc._alpha = a;
mc._xscale = mc._yscale = s;
}
myMovieClipLocator.processOnAllValues( changeAlpha, .4, 50 );
public function register(name:String, o:Object):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Registers passed-in object with identifier name to this locator.
Parameters
| name:String — Key identifier
|
| |
| o:Object — Object to store
|
Returns
| Boolean — true if success
|
Throws
| — IllegalArgumentException — Key or object
are already defined in this locator.
|
public function release():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Clears all association between keys and objects
registered for this locator.
public function removeEventListener(type:String, listener:Object):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes the passed-in listener for listening the specified event. The
listener could be either an object or a function.
Parameters
| type:String — name of the event for which unregister the listener
|
| |
| listener:Object — object or function to be unregistered
|
Returns
| Boolean — true if the listener have been successfully removed
as listener for the passed-in event
|
public function toString():String
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the string representation of this instance.
Returns
| String — the string representation of this instance
|
public function unregister(name:String):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Unregisters object registered with identifier name.
Parameters
| name:String — Key identifier
|
Returns
| Boolean — true if success
|
LowRA API documentation 2008- 2009
Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1
mer. févr. 25 2009, 9:22 AM GMT+01:00