Crux Configuration
Learn how to configure Crux
Page Contents:
Configuration Overview
You configure each Crux instance using the CruxConfig
class. It allows you to modify common settings, and to provide values that allow your tags and code elsewhere to be more concise. Below is an example with all properties shown. Where applicable, they have been set to their default values. However, in most cases, the default values should work fine (see the note below on Configuration Defaults).
<crux:Crux>
<crux:beanProviders>
<local:MyBeans/>
</crux:beanProviders>
<crux:config>
<crux:CruxConfig
eventPackages="com.foo.event.*, org.bar.event.*"
viewPackages="com.foo.view.*, org.bar.view.*"
defaultFaultHandler="handleUnhandledFaults"
defaultDispatcher="global" />
</crux:config>
</crux:Crux>
Configuration Defaults. Unless you are specifying your own set up and tear down values, the only configuration values that commonly need to be set are
eventPackages
andviewPackages
. If you are using Crux’s support for server communication, you may also setdefaultFaultHandler
.
Specifying Packages. Note that due to limitations in the AS3 reflection API, when you define
eventPackages
, you must specify each package individually. Children of your specified packages cannot be resolved and must be explicitly set. This limitation does not apply toviewPackages
because they are handled differently, but for consistency it may be useful to use the same rules to define both sets of packages.
Default Dispatcher
The default dispatcher value is “global”. This means that in the case where a Crux instance is the child of another Crux instance, the child will use the parent dispatcher. This allows for easy communication between Crux instances, since they all share the same event dispatcher. However, if you want to force a child Crux to use it’s own dispatcher, you can set this value to “local”. In most cases, developers should not need to change the default value (“global”). More information on parent-child Crux instances can be found in the section on Module support.