Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width15px

Column
Wiki Markup

You configure each Swiz instance using the SwizConfig 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.

{html}<script src="http://gist.github.com/370666.js?file=gistfile1.xml"></script>{html}
\\

{info:title="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}} and {{viewPackages}}. If you are using Swiz's support for server communication, you may also set {{defaultFaultHandler}}. 
{info}

{infonote:title="Specifying Packages"}
Note that due to limitations in the AS3 reflection API, when you define packages such as {{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 to {{viewPackages}} because they are handled differently, but for consistency it may be useful to use the same rules to define both sets of packages. 
{info}

h4. setUpEventType, setUpEventPhase and setUpEventPriority
These properties configure the listener that Swiz will use to trigger the set up of views (assuming they are eligible) to inject dependencies, create mediators, etc. The default is a capture phase listener (to catch all views regardless of their place in the display list hierarchy) for the {{Event.ADDED_TO_STAGE}} event, with a priority of 50.
\\

h4. tearDownEventType, tearDownEventPhase and tearDownEventPriority
These properties configure the listener that Swiz will use to trigger the tearing down of views to clean up injected dependencies, remove mediators, etc. The default is a capture phase listener for the {{Event.REMOVED_FROM_STAGE}} event, with a priority of 50.

Column
width15%