carlosrovira commented on issue #939:
URL: https://github.com/apache/royale-asjs/issues/939#issuecomment-730670156


   Hi, 
   
   before going further, for next questions please try to shrink to the minimun 
expression since this kind of long question are hard to follow.
   
   About how to solve your problem. I think best way is to use events:
   
   1 - In your inner component (in your case your login form) you can have a 
button that create an event:
   
   ```mxml
   <j:Button click="sendSomeEvent();" text="send event"/>
   ````
   and
   ```as3
   private function sendSomeEvent():void {
        var e:Event = new Event('MY_EVENT');
        dispatchEvent(e);
   }
   ```
   
   then in your main component you must listen for that event.
   
   Let's say that your login form has a `localID="myloginForm"`
   
   ```as3
   myloginForm.addEventListener('MY_EVENT', myEventHandler);
   ```
   
   then  you have the event handler:
   
   ```as3
   public function myEventHandler(e:Event):void
   {
       trace("do something");
   }
   ```
   
   another  way to solve with events is to use `bubbling events` adding `true` 
as the second param in the event `var e:Event = new Event('MY_EVENT', true);`, 
then this event will bubble over the DOM to reach the main component and you 
can just listen `addEventListener('MY_EVENT', myEventHandler);` (without using 
`myloginForm`)
   
   HTH
   
   Carlos


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to