Need Help?

For technical questions, feel free to ask on the Swiz mailing list.

Save as HTML or PDF

You can export this entire Wiki in HTML or PDF format.

Child pages
  • Updating a Swiz 0.6.4 application to Swiz 1.0
Skip to end of metadata
Go to start of metadata

Updating a Swiz 0.6.4 application to Swiz 1.0 will require the following changes:

Update configuration and creation of Swiz

Prior to 1.0, there was only one instance of Swiz. 1.0 now allows for multiple versions of Swiz, primarily to support modules and separate AIR windows. As a result, the creation of Swiz within the application will need to be modified.

In a 0.6.4 application, Swiz was created like this:

	beanLoaders="{[Beans]}" />

In Swiz 1.0, this would look like:

			viewPackages="myapp.view" />

You might also note that several of the properties on Swiz have changed:

  • the strict property has been renamed validateEventTypes, and now defaults to true so in most cases it can be removed
  • mediateBubbledEvents has been removed since Swiz 1.0 mediates bubbled events automatically
  • the beanLoaders property has been renamed to beanProviders, and has been moved to the Swiz class
  • the eventPackages and viewPackages now accept package paths in both the format and*. Note that you still need to specify child packages separately even if you use the .* syntax.
  • the injectionEvent property has been renamed setUpEventType, and now defaults to Event.ADDED_TO_STAGE instead of Event.PREINITIALIZE

Full details on configuration and the default values for 1.0 can be found in the Configuration section.

The BeanLoader class has been deprecated in favor of BeanProvider. BeanLoader will still work in 1.0, but it is recommended that you update your code to BeanProvider. In addition, a central dispatcher property was available within BeanLoader in 0.6.4. This property has been removed in 1.0. If a bean or prototype bean requires a dispatcher from Swiz, this is now accomplished using the [Dispatcher] metadata tag:

public var dispatcher:IEventDispatcher;

Removal of static methods

Since an application can now contain multiple instances of Swiz, the static methods on the Swiz class had to be removed. This means that code relying on static methods such as Swiz.dispatchEvent() must be modified. In 1.0, event dispatching typically uses a dispatcher injected using the [Dispatcher] metadata tag. This approach causes much less coupling to Swiz and results in a more flexible application. Full details on the event handling capabilities can be found in the Event Handling section.

Other changes

  • the [Autowire] metadata tag has been deprecated in favor of [Inject]. [Autowire] will still function in 1.0 but it is recommended that you update your code to use [Inject].
  • No labels


  1. Anonymous

    Hi, I'm happy with the integration with modules.
    Where can I see any application using a BeanLoader for each MODULE?


  2. Anonymous

    I wonder the same thing!! where can I find an example using a swiz instance in each module and beans on each module??? That would be much appreciated !! thank you ....

  3. Anonymous

    It looks like Prototype has changed as well. You use to be able to do a getObject() ... Not sure what this was replaced with.

    1. I believe what you're looking for is the 'source' property.