# Need Help with Actionscript!

**URL:** <https://forum.kirupa.com/t/need-help-with-actionscript/227403>\
**Category:** flash\
**Created:** [May 30, 2007, 12:24am UTC](https://forum.kirupa.com/t/need-help-with-actionscript/227403 "2007-05-30T00:24:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAM7167](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@SAM7167](https://forum.kirupa.com/u/SAM7167)\
**Post date:** [May 30, 2007, 12:24am UTC](https://forum.kirupa.com/t/need-help-with-actionscript/227403/1 "2007-05-30T00:24:38Z")

</div>

[F8]  
Ok, I’ve got this assignment that I’m stuck with.  
I was supposed to:  
_[INDENT]set the validate range for the Name field to be checked with an array of 3 names, the validate range for the Password field to be checked with an array of 3 passwords, and the validate range for the State field to be checked with an array of 3 states in order to create my own error messages.[/INDENT]_  
Can someone tell me what I did wrong?

[COLOR=Navy]\*\*stop();  
var errors:Array=new Array();

function clearForm() {  
name\_ti.text="";  
state\_ti.text="";  
password\_ti.text="";  
errorLog\_lb.removeAll();  
errors.length = 0;  
errorLog\_lb.alternatingRowColors = null;  
}

function validateState() {  
var states:Array = [“California”, “New York”, “Louisiana”];  
var matchFound:Boolean = false;  
for (var i = 0; i \<= states.length; ++i) {  
if (state\_ti.text== states\*) {  
matchFound = true;  
break;  
}  
}  
if (!matchFound) {  
errors.push(“Please enter a valid state”);  
state\_ti.setStyle(“color”, 0x990000);  
}  
}

function validateName() {  
var names:Array = [“Julia”, “Robin”, “Patricia”];  
var matchFound:Boolean = false;  
for (var i = 0; i \<= names.length; ++i) {  
if (name\_ti.text== names\*);  
matchFound = true;  
break;  
}  
}  
if (!matchFound) {  
errors.push(“Please enter a valid name.”);  
name\_ti.setStyle(“color”, 0x990000);  
}

function validatePassword() {  
var passwords:Array = [“1234”, “4567”, “7890”];  
var matchFound:Boolean = false;  
for (var i = 0; i \<= passwords.length; ++i) {  
if (password\_ti.text== passwords\*) {  
matchFound = true;  
break;  
}  
}  
if (!matchFound) {  
errors.push(“Please enter a valid password”);  
password\_ti.setStyle(“color”, 0x990000);  
}  
}  
clearButton\_mc.onRelease = function(){  
clear();  
}

\*\*[/COLOR]

P.S.: Let me know if you’re willing to help me and I’ll send you the file directly via email.  
I can’t upload it 'cause it’s too large.
