Hi Marco,
That does look like a problem. The dispatchEvent() method is available
for any UIComponent subclass or any class that extends EventDispatcher.
So, if you're going to use [Bindable] properties in the presentation
model, you would want to have the PM extend EventDispatcher:
import flash.events.EventDispatcher;
public class UserPresentationModel extends EventDispatcher
{
private var _currentState : String;
[Bindable( "currentStateChanged" )]
public function get currentState() : String
{
return _currentState;
}
public function set currentState( state : String ) : void
{
_currentState = state;
dispatchEvent( new Event( "currentStateChanged" ) );
}
}
This will allow you to bind the property to a view.
For events that you want to [Mediate], you would use the injected
dispatcher:
[Dispatcher]
public var dispatcher:IEventDispatcher;
dispatcher.dispatchEvent( new Event( "myEvent" ) );
-TH
--- In [email protected], Marco Catunda <marco.catu...@...>
wrote:
>
> Hi,
>
> I'm learning swiz framework and stumble upon this code
http://www.pastebin.org/307313
> at
http://www.briankotek.com/blog/files/swiz_10_rc_example/srcview/index.ht\
ml
>
> My question is how could flex compiler understand the 'dispatchEvent'
method in
> line 41 and 65? I haven't seen any explicit import of it.
>
> Cheers
>
> --
> Marco Catunda
>