hello friend I want to refer my mxml file into Actionscript class.My code is :-
Mxml file is :-
<?xml version="1.0" encoding="utf-8"?>
<!-- usingas/AccessingPackagedClasses.mxml -->
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import SBTSBusineesObject.Authentication;
public function authentication():void
{
var User:Authentication;
User = new Authentication();
User.authentication();
}
]]>
</mx:Script>
<mx:Panel width="100%" height="100%" layout="absolute">
<mx:TabNavigator width="100%" height="100%" id="viewstack2">
<mx:Form label="Login Form" id="loginform">
<mx:FormItem label="Mobile no:" creationPolicy="all">
<mx:TextInput id="mobileno"/>
</mx:FormItem>
<mx:FormItem label="Password:" creationPolicy="all">
<mx:TextInput displayAsPassword="true" id="password" />
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Login" click="authentication()"/>
</mx:FormItem>
</mx:Form>
<mx:Form label="Child List">
<mx:Label width="100%" color="blue"
text="Select Child."/>
</mx:Form>
</mx:TabNavigator>
</mx:Panel>
</mx:WindowedApplication>
Action script class is
package SBTSBusineesObject
{
import generated.webservices.*;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
public class Authentication
{
[Bindable]
private var childName:ArrayCollection;
[Bindable]
private var childId:ArrayCollection;
private var photoFeed:ArrayCollection;
private var arrayOfchild:Array;
private var newEntry:GetSBTSMobileAuthentication;
public var user:SBTSWebService;
public var mxmlobj:SBTS =null;
public function authentication():void
{
user = new SBTSWebService();
mxmlobj = new SBTS();
if(user!=null)
{
user.addSBTSWebServiceFaultEventListener(handleFaults);
user.addgetSBTSMobileAuthenticationEventListener(authenticationResult);
newEntry = new GetSBTSMobileAuthentication();
if(newEntry!=null)
{
if(mxmlobj != null)
{
newEntry.mobile = mxmlobj.mobileno.text ;
newEntry.password=mxmlobj.password.text;
}
user.getSBTSMobileAuthentication(newEntry);
}
}
}
public function handleFaults(event:FaultEvent):void
{
Alert.show("A fault occured contacting the server. Fault message is: " + event.fault.faultString);
}
public function authenticationResult(event:GetSBTSMobileAuthenticationResultEvent):void
{
if(event.result != null && event.result._return>0)
{
if(event.result._return > 0)
{
var UserId:int = event.result._return;
if(mxmlobj != null)
{
mxmlobj.loginform.enabled = false;
mxmlobj.viewstack2.selectedIndex=1;
}
}
else
{
Alert.show("Authentication fail");
}
}
}
}
}