1 Replies - 8410 Views - Last Post: 04 November 2011 - 03:24 AM

#1 antarr.byrd  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 247
  • Joined: 30-August 09

ActionScript Newby

Posted 02 November 2011 - 02:23 PM

I'm trying to make my first Flex application. The problem is that i keep getting these errors when building

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.


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;
		}
	}
}


Is This A Good Question/Topic? 0
  • +

Replies To: ActionScript Newby

#2 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 1009
  • View blog
  • Posts: 4,209
  • Joined: 14-February 08

Re: ActionScript Newby

Posted 04 November 2011 - 03:24 AM

Are you building this in Flash or in FlashBuilder? If you are using an fla in flash cs5 then you will have to link to the source you are using as well.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1