Announcement Announcement Module
Collapse
No announcement yet.
EventHandler Annotations in Modules Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • EventHandler Annotations in Modules

    Hi All,

    I've been scouring the forums for quite a while and can't seem to find what I am looking for. I have a main application SWF that is running in AIR and has a module that it loads using:

    <mx:ModuleLoader id="modLoader" width="100%" height="100%" applicationDomain="{ApplicationDomain.currentDomai n}" creationComplete="loadModule();"/>

    In the loadModule function, everything loads correctly and functions.

    Both the main project and module have the following compiler directive:

    -keep-as3-metadata+=EventHandler

    Also, in the application context file, I have:

    <object id="eventhandlerProcessor" class="org.springextensions.actionscript.ioc.facto ry.config.EventHandlerMetaDataPostProcessor"/>

    In the module, however, I am throwing a custom exception:

    EventBus.dispatchEvent(new DeleteMedicationRow("deleteMedicationRow",data as MedicationModel));

    In am MXML class in the module, I have:


    [EventHandler(name="deleteMedicationRow")]
    private function deleteMedicationRow(event:Event):void ...

    This never gets fired. I can do:

    EventBus.addEventListener("deleteMedicationRow",de leteMedicationRow);

    but not the annotations version. I've tried all sorts of permutations for the annotation and the function signature, but nothing seems to work. Is there something else that I need to do in order to get the annotations to work?

    The module does not load it's own application context, like other forum members are doing. As far as I understand, it does not need to do that.

    Any thoughts would be appreciated. I can certainly use the brute force method, but I'd like to use the annotations given the simplicity of the code.

    Thanks,
    Tom

  • #2
    module policy

    Hey Tom,

    if remember correctly, in 1.0RC1 modules are ignored by default by the container. To change this behaviour, add this line of code to your bootstrap (just before you load your context):

    Code:
    FlexStageProcessorRegistry.getInstance().modulePolicy = ModulePolicy.AUTOWIRE;
    That should fix your trouble, unless you're loading your modules into their own application domain, in that case there's no other way then to have them create their own contexts.

    cheers,

    Roland
    Last edited by 666shooter; Aug 9th, 2010, 03:59 AM.

    Comment

    Working...
    X