0
我试图创建一个添加用户新用户()的简单表单。但是当我构建它时,我在同一行上得到两个错误。新动作脚本
调用可能未定义的方法用户。并且找不到类型或者不是编译时间常量。
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="1116" height="633" initialize="windowedapplication1_initializeHandler(event)">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import me.*;
var usercollection:Array = new Array();
var userOne:User = new User;
protected function button1_clickHandler(event:MouseEvent):void
{
userOne.fname = firstNameInput.text;
userOne.lname = lastNameInput.text;
userOne.dob = dateChooser.selectedDate;
usercollection.push();
}
]]>
</fx:Script>
<mx:DataGrid x="832" y="9">
<mx:columns>
<mx:DataGridColumn headerText="First Name" dataField="fname"/>
<mx:DataGridColumn headerText="LastName" dataField="lname"/>
</mx:columns>
</mx:DataGrid>
<mx:Form x="115" y="61" width="562" height="325">
<mx:FormItem label="First Name">
<s:TextInput id="firstNameInput"/>
</mx:FormItem>
<mx:FormItem label="Last Name">
<s:TextInput id="lastNameInput"/>
</mx:FormItem>
<mx:FormItem label="Date Of Birth">
<mx:DateChooser id="dateChooser"/>
</mx:FormItem>
<s:Button label="Submit" click="button1_clickHandler(event)"/>
</mx:Form>
</s:WindowedApplication>
实体包
package me.entities
{
public class Person
{
public var fname:String;
public var lname:String;
public var dob:Date;
}
public class User extends Person
{
public var crypted_password:String;
public var salt:String;
public var created_at:Date;
public var last_login:Date;
public var last_ip:String;
}
}
现在给了我这些错误。 -Person -1017:未找到基类Person的定义。 -15换线 –
嗯,这对我很有用,所以我不知道为什么它不适合你。只是在一个全新的项目中进行测试。我编辑我的文章,因为不需要导入行,但它应该工作。这只是无用的。 – Exort
@atbyrd这个错误是因为你没有将Person类放入用户类“import me.entities.User;” –