PDA

View Full Version : Error code 1131


harikrishna
01-27-2009, 08:20 AM
I am begginer in flex.
when i was trying to write code in as files.I am unable to import the class file in mxml document .please help me to acess members of a class in mxml file.
my code im mxml document
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="black" >
<mx:Script >
<[CDATA[
import mx.controls.Alert;
import codefiles.login ;
import flash.events.Event;

public function onPress1(event:Event):void

{
Alert.show("onpress");
onPress();
}
]]>
</mx:Script>
<mx:Canvas>
<mx:Label id="userName_lbl" text="User Name :" y="200" fontSize="14" x="350" color="white">
</mx:Label>
<mx:TextInput id="userName_txt" x="450" y="200" borderStyle="solid" focusEnabled="true" >
</mx:TextInput>
<mx:Label id="password_lbl" text="Password :" y="250" fontSize="14" x="350" color="white">
</mx:Label>
<mx:TextInput id="password_txt" x="450" y="250" borderStyle="solid" displayAsPassword="true" >
</mx:TextInput>
<mx:Button id="login_btn" label="Login" x="450" y="300" textRollOverColor="white" textSelectedColor="blue" click="onPress1(event)"/>
</mx:Canvas>
</mx:Application>


code in as file

[SWF(width="500", height="400", frameRate="30", backgroundColor="#ffffff")]
package codefiles
{
import mx.controls.Alert;

class login
{
public function login()
{
Alert.show("login constructor");
var i = 0 ;
i++ ;
}
public function onPress():void
{
trace(" onPress function");
var i = 0 ;
i++ ;
}

}
}

wvxvw
01-27-2009, 08:56 AM
Class "login" should be called "Login" for the start... but... where did you want to use it? Your MXML and AS files are not related, meaning, where did you want to use that login class / what should it do?