Quote
Multiple markers at this line:
-1180: Call to a possibly undefined method Person.
-1046: Type was not found or was not a compile-time constant: Person.
-1180: Call to a possibly undefined method Person.
-1046: Type was not found or was not a compile-time constant: Person.
I don't understand it because to IDE(FlashBuilder). can see the class
<?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="572" height="433" initialize="windowedapplication1_initializeHandler(event)">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import me.entities.Person;
import org.as3commons.collections.*;
import org.as3commons.collections.utils.CollectionUtils;
var userSet:Set = new Set();
protected function button1_clickHandler(event:MouseEvent):void
{
var d:Date = new Date();
if(dateChooser.selectedDate != null)
{
d = dateChooser.selectedDate;
}
else
{
d = new Date("Sat Nov 30 1974");
}
var person:Person = new Person(lastNameInput.text, firstNameInput.text, d)
userSet.add(person);
gridOne.data = userSet;
}
]]>
</fx:Script>
<mx:DataGrid x="323" y="10" id="gridOne">
<mx:columns>
<mx:DataGridColumn headerText="First Name" dataField="fname"/>
<mx:DataGridColumn headerText="LastName" dataField="lname"/>
</mx:columns>
</mx:DataGrid>
<mx:Form x="4" y="3" width="311" height="325">
<mx:FormItem label="First Name">
<s:TextInput id="firstNameInput"/>
</mx:FormItem>
<mx:FormItem label="Last Name">
<s:TextInput id="lastNameInput" enabled="true"/>
</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>
Person Class
package me.entities
{
import com.adobe.crypto;
import com.adobe.crypto.MD5;
public class Person
{
public var fname:String;
public var lname:String;
public var dob:Date;
public var crypted_password:String;
public var salt:String;
public var created_at:Date;
public var last_login:Date;
public var last_ip:String;
function Person(l:String, f:String, d:Date)
{
fname = f;
lname = l;
dob = d;
salt = generateRandomString(64,9999);
}
function Person() //create salt dynamically if not paramaters are passed
{
salt = generateRandomString(64,9999);
}
function Person(l:String, f:String, d:Date, pass:String) //store new person with MD5 encrypted password
{
fname = f;
lname = l;
dob = d;
salt = generateRandomString(64,9999);
crypted_password = MD5(pass+salt);
}
function generateRandomString(newLength:Number):String{
var a:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var alphabet:Array = a.split("");
var randomLetter:String = "";
for (var i:Number = 0; i < newLength; i++){
randomLetter += alphabet[Math.floor(Math.random() * alphabet.length)];
}
return randomLetter;
}
}
}

New Topic/Question
Reply



MultiQuote



|