How can i call MXML components inside my ActionScript Class.
// filename.mxml
<mx:Canvas x="181" y="180" width="333">
     <mx:Button styleName="LoginButton" id="loginButton" click="checkLogin();" x="160" y="261"/>
     <mx:TextInput styleName="loginTextInput" id="username" x="160" y="161"/>
     <mx:TextInput styleName="loginTextInput" id="password" displayAsPassword="true" x="160" y="191"/>
 </mx:Canvas>
</mx:Canvas>
// main.as [ Class File ]
var obj:filename= new filename();
     private function label_link(evt:TextEvent):void {
                obj.currentState = "defaultindex";
          obj.username.text = "";
          obj.password.text = "";
                }
Objective
I need to access the username and password fields of MXML in my ActionScript Class.