Stops to command map an event from a 3rd party swc
I am using the osmf.swc to build a vid player and meshing it with Robotlegs for a nice framework.
To get in on the events sent by OSMF
-
Mediate a certain video event with my own custom event class
eventMap.mapListener(myComponent, ControlBarEvent.CONTROL_BAR_PLAY_EVENT, handleComponentEvent, ControlBarEvent); -
Dispatch into framework
private function
handleComponentEvent(evt:ControlBarEvent):void
{
// framework will clone the event by default i think
this.dispatch(evt);
}
3 Finally I need to have already mapped to a command for the event - bear in mind I have had to dispatch the event myself into the framework
commandMap.mapEvent(ControlBarEvent.CONTROL_BAR_PLAY_EVENT, PlayPauseCommand, ControlBarEvent, false);
4 Update the model with the coammand - in this case the PlayPauseCommand
So is that about right or am I being too verbose with my code ?
- I kind of worked the above out through a bit of trial and
error
but would welcome a more concise way of doing things.
regards
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 31 May, 2010 06:45 AM
Only thing I would do differently is
eventMap.mapListener(myComponent,
ControlBarEvent.CONTROL_BAR_PLAY_EVENT, dispatch, ControlBarEvent);
Then you could eliminate the method that dispatches the event to the event bus.
Stray closed this discussion on 10 Feb, 2011 05:25 PM.