Stops to command map an event from a 3rd party swc

kevin.dowd's Avatar

kevin.dowd

31 May, 2010 05:52 AM

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

  1. Mediate a certain video event with my own custom event class
    eventMap.mapListener(myComponent, ControlBarEvent.CONTROL_BAR_PLAY_EVENT, handleComponentEvent, ControlBarEvent);

  2. 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

  1. 1 Posted by Jason Dias on 31 May, 2010 06:45 AM

    Jason Dias's Avatar

    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.

  2. Stray closed this discussion on 10 Feb, 2011 05:25 PM.

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