redispatch - command - event properties
Hi Guys,
I have a command mapped to a navigation event, NavigationEvent is overriding clone:
commandMap.mapEvent( NavigationEvent.ON_ITEM_SELECT, NavigationCommand, NavigationEvent );
In my navigation item view i dispatch this navigation event to it's mediator, passing a vo:
var e:NavigationEvent = new NavigationEvent( NavigationEvent.ON_ITEM_SELECT);
e.vo = vo;
dispatchEvent( e );
the mediator grabs this and sends the event to the command via addViewListener:
addViewListener( NavigationEvent.ON_ITEM_SELECT, dispatch, NavigationEvent );
the command fires but I am unable to retrieve the value object in NavigationCommand, the value object is null:
[Inject]
public var event:NavigationEvent;
…
override public function execute():void
{
trace( this + "vo : " + event.vo );
}
if I repackage the event in my mediator it will work fine, the command is called and the event property is passed:
addViewListener( NavigationEvent.ON_ITEM_SELECT, doRepackage, NavigationEvent );
…
private function doRepackage( e:NavigationEvent ):void {
var event:NavigationEvent = new NavigationEvent( NavigationEvent.ON_ITEM_SELECT );
event.vo = e.vo;
dispatch( event );
}
I'm just wondering if maybe I'm overlooking something?
using 1.4.0.
Thanks,
Dunc
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Jason Dias on 08 Nov, 2010 06:54 PM
Can you post your clone method?
It sounds like you're not reassigning the vo in the clone method.
2 Posted by duncan.reid on 08 Nov, 2010 07:00 PM
Hi Jason,
Thanks for the quick response. This is what my NavigationEvent looks like where I am overriding clone, is this what you are asking for?
override public function clone():Event {
} }
Thanks again,
Dunc
3 Posted by Jason Dias on 08 Nov, 2010 07:08 PM
Yea, you need to reassign the vo in the clone,
`override public function clone():Event {
}`
4 Posted by duncan.reid on 08 Nov, 2010 07:51 PM
Ok, I see. Thanks much for your help Jason!
Stray closed this discussion on 10 Feb, 2011 06:07 PM.