2 Replies Latest reply on Dec 6, 2006 3:07 AM by thespark

    Child control events

    thespark
      Okay I have custom control based on panel. That contains 2 input text control 1 textarea and a button.
      I add my panel control in to a viewstack that has 2 canvas.
      Now My question is that how can I change viewstack canvas when I click that button in the custom control or alternative. how can i listen that buttons event.
        • 1. Re: Child control events
          ntsiii Level 3
          Ok, I am still a bit soft on events, but since no one else has responded,try this (no warranty):
          in the component, dispatch an event, with the bubbles arg=true:
          <mx:Button click="displatchEvent(new Event("myButtonClick",true))" .../>

          In the main app, since the event is bubbling, you should be able to listen for it. In a function called by initialize or creationComplete:
          this.addListener("myButtonClick", myButtonClickHandler);

          private function myButtonClickHandler(event:Event):void {
          Alert.show("myButtonClick");

          Tracy
          • 2. Re: Child control events
            thespark Level 1
            Thank's that works perfectly!

            btw this.addListener("myButtonClick", myButtonClickHandler); should be:
            this.addEventListener("myButtonClick", myButtonClickHandler);