title: Flash Builder 4: Call main function from a component function
body: <p>i try to make a login sistem in flex, and my app looks like this:</p>
  
  <p>i have a main.mxml. when the app loads, a function named "start" is called. it verifies if the user is logged in or not. if "true" the user is redirected to a dashboard, if "false", a component named login is loaded.</p>
  
  <p>my login.mxml component has 2 input boxes (user &amp; pass) and a "Submit" button. when the button is pressed a function named "send_login" sends the user and the pass values to the server.</p>
  
  <p>My problem sounds like this: when i press the Submit button in my login component, after user and pass are sended... i want to call again the "start" function from my main.mxml to check again if the user is logged in or not... </p>
  
  <p>i need some kind of as2 "_root"</p>
  
  <p>this is how my code looks:</p>
  
  <p>main.mxml</p>
  
  <pre><code>public function start():void {
    currentState="Start";
    loginstatus();
   }
  </code></pre>
  
  <p>login.mxml</p>
  
  <pre><code>private function send_login(event:Event):void {
  
   ... bla bla send user and pass....
   scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
  }
  
  private function handleLoadSuccessful(evt:Event):void { 
  
   trace("Data sent.");
    start();  &lt;-- HERE i want to call the function from main.mxml
  }
  </code></pre>
  
  <p>any help is welcomed!</p>