Package | com.yworks.mxml |
Class | public class ConfigTool |
Inheritance | ConfigTool flash.events.EventDispatcher |
Implements | mx.core.IMXMLObject |
Config.getInstance().addEventListener(Event.COMPLETE, configComplete);
The config will be loaded when
configURL
is set and the loadNow
parameter is set
to true
:
<yworks:ConfigTool configURL="config.xml" loadNow="true"/>
configURL
and a listener for the complete
event are set:
<yworks:ConfigTool configURL="config.xml" complete="onComplete(event)"/>
complete
event is fired. Setting the
waitForApplication
property to true
will
make ConfigTool
wait to fire the complete
event when
the application is completely initialized (applicationComplete
fired)
and the config is loaded. With these settings it is possible to initialize
the application in the listener for the complete
event:
<yworks:ConfigTool configURL="config.xml" complete="init()" waitForApplication="true"/>
See also
Property | Defined By | ||
---|---|---|---|
configURL : String [write-only]
Sets the URL from which the config will be loaded. | ConfigTool | ||
loadNow : Boolean [write-only]
When set to true, the config will be loaded as soon as the
configURL is set. | ConfigTool | ||
waitForApplication : Boolean [write-only]
When set to true, a complete event will be fired
when the application is completely initialized and the config
is loaded. | ConfigTool |
Method | Defined By | ||
---|---|---|---|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [override]
If a listener is added for the Event.COMPLETE event type,
this implementation will trigger loading of the config file. | ConfigTool | ||
initialized(document:Object, id:String):void
Called automatically by the MXML compiler when the ConfigTool is created
using an MXML tag. | ConfigTool |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the configuration file has been parsed. | ConfigTool | |||
Dispatched when the configuration file could not be loaded. | ConfigTool | |||
Dispatched when the configuration file could not be loaded due to a security error. | ConfigTool |
configURL | property |
configURL:String
[write-only] Sets the URL from which the config will be loaded.
public function set configURL(value:String):void
loadNow | property |
loadNow:Boolean
[write-only]
When set to true
, the config will be loaded as soon as the
configURL
is set.
The default value is false
.
public function set loadNow(value:Boolean):void
waitForApplication | property |
waitForApplication:Boolean
[write-only]
When set to true
, a complete
event will be fired
when the application is completely initialized and the config
is loaded.
By default the application may not be initialized at the moment
complete
is fired. Setting this property to true
allows to initialize the application in the listener for the complete
event.
The default value is false
.
public function set waitForApplication(value:Boolean):void
addEventListener | () | method |
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
If a listener is added for the Event.COMPLETE
event type,
this implementation will trigger loading of the config file.
Parameters
type:String — The type to listen for.
| |
listener:Function — The listener function.
| |
useCapture:Boolean (default = false )
| |
priority:int (default = 0 )
| |
useWeakReference:Boolean (default = false )
|
initialized | () | method |
public function initialized(document:Object, id:String):void
Called automatically by the MXML compiler when the ConfigTool is created using an MXML tag.
This implementation does nothing.
Parameters
document:Object — The MXML document containing this instance.
| |
id:String — The id of this instance.
|
complete | Event |
flash.events.Event
flash.events.Event.COMPLETE
Dispatched when the configuration file has been parsed.
ioError | Event |
flash.events.IOErrorEvent
flash.events.IOErrorEvent.IO_ERROR
Dispatched when the configuration file could not be loaded.
securityError | Event |
flash.events.SecurityErrorEvent
flash.events.SecurityErrorEvent.SECURITY_ERROR
Dispatched when the configuration file could not be loaded due to a security error.