Skip to content

Instantly share code, notes, and snippets.

// Inject Bean Property (The property named "userCollection" from the bean named "userModel" is injected)
[Inject( source="userModel.userCollection" )]
public var users:ListCollectionView;
[EventHandler( event="UserEvent.*", properties="user" )]
public function handleUserEvents( user:User ):void
{
// do stuff
}
<swiz:SwizConfig
strict="true"
mediateBubbledEvents="true"
eventPackages="myapp.event"
viewPackages="myapp.view"
beanLoaders="{[Beans]}" />
<swiz:Swiz>
<swiz:beanProviders>
<swiz:BeanProvider>
<swiz:Bean name="applicationModel">
<model:ApplicationModel />
</swiz:Bean>
<swiz:Bean name="userController">
<control:UserController />
</swiz:Bean>
</swiz:BeanProvider>
<swiz:BeanProvider
xmlns:swiz="http://swiz.swizframework.org" xmlns:service="org.swizframework.quickswiz.service.*"
xmlns:controller="org.swizframework.quickswiz.controller.*">
<service:UserService id="userService"/>
<controller:UserController id="userController"/>
<!-- We'll use the Swiz ServiceHelper to help simulate a server-side call. -->
<swiz:ServiceHelper id="serviceHelper" />
package org.swizframework.quickswiz.controller
{
import org.swizframework.quickswiz.service.UserService;
public class UserController
{
[Inject]
public var userService : UserService;
[PostConstruct]
<swiz:BeanProvider
xmlns:swiz="http://swiz.swizframework.org"
xmlns:storage="org.swizframework.storage.*">
<storage:SharedObjectBean id="soBean" />
</swiz:BeanProvider>
package org.swizframework.testapp.control
{
import org.swizframework.testapp.event.MyEvent;
import flash.events.IEventDispatcher;
public class MyController
{
[Dispatcher]
public var dispatcher : IEventDispatcher;
package org.swizframework.quickswiz.controller
{
import org.swizframework.quickswiz.model.User;
import org.swizframework.quickswiz.service.UserService;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import org.swizframework.utils.services.ServiceHelper;
public class UserController
{
<foo>
<boo />
</foo>