0

I am trying to use selector(which to filter event when command Object recevind the event, but never get's called!! help here my pieces of code: Inmy context file:

    <MapCommand type="com.pz.events.FolderEvent" selector="folderDelete">
        <Command type="com.pz.command.DeleteFolderCommand"/>
    </MapCommand>

dipatching event code pieces:

    dispatchEvent(new FolderEvent(FolderEvent.FOLDER_DELETED,targetRoot.selectedItem));

MetaTag:

[Event(name="folderDelete",type="com.pz.events.FolderEvent")]
[ManagedEvents("folderCreate,folderDelete,folderOpen,folderClose,folderRelocate")]
Oscar Wu
  • 31
  • 4

1 Answers1

2

The problem probably lies in you configuration file. The type attribute of MapCommand tag is not a message type, but a command type. For messages messageType attribute is used.

So your MXML code should look like this:

<MapCommand messageType="com.pz.events.FolderEvent" selector="folderDelete">
    <Command type="com.pz.command.DeleteFolderCommand"/>
</MapCommand>

Or this:

<MapCommand type="com.pz.command.DeleteFolderCommand" messageType="com.pz.events.FolderEvent" selector="folderDelete"/>
Hunternif
  • 2,370
  • 2
  • 17
  • 14