Results 1 to 3 of 3

Thread: route mx.events.FlexEvent

  1. #1
    Join Date
    Feb 2011
    Posts
    2

    Default route mx.events.FlexEvent

    Hi,

    im using EventBus and everything is fine. is there any way to route creationComplete - mx.event.FlexEvent in mxml file? i want to handle these kind of events via EventBus.

    i tried this:

    Code:
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">
    
     <fx:Metadata>
            [RouteEvents]
            [Event(name="creationComplete", type="mx.events.FlexEvent")]
       </fx:Metadata>
    
    [EventHandler]
     public function creationComplete(event: FlexEvent): void {
                Alert.show("EventBus said:  creation completed");
    
            }
    
    </s:Group>
    regards,

  2. #2
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default not like that

    Hey there,

    I'm afraid this won't work, the [RouteEvents] metadata will indeed be picked up by the correct postprocessor but the main problem is that this will happen AFTER the creationComplete event has already been fired, this is because by the time the postprocessor is invoked the MXML component has been added to the stage already (so its creation has already been complete).

    You could inject the EventBus instance into your stage component and then create and dispatch a creationComplete event through the EventBus instance manually.

    cheers,

    Roland

  3. #3
    Join Date
    Feb 2011
    Posts
    2

    Default

    hi,

    this is very helpful thank you....

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •