I have this code where it computes the name of the user and tells it color but it keeps on error
TypeError: Error #1006: value is not a function.
This is the code of my flash:
import flash.events.MouseEvent;
checkBtn.addEventListener(MouseEvent.CLICK, checkClick);
function checkClick(event:MouseEvent): void
{
var my_str:String = input1.text;
var size:int = 0;
for(var i:int = 0; i<my_str.length; i++)
{
size++;
}
var my_array:Array = my_str.split(' ');
var firstLetter:int = 0;
var lastLetter:int = 0;
if(my_array[0] == 'a'){
firstLetter = 1
}
if(my_array[0] == 'b'){
firstLetter = 2
}
if(my_array[0] == 'c'){
firstLetter = 3
}
if(my_array[0] == 'd'){
firstLetter = 4
}
if(my_array[0] == 'e'){
firstLetter = 5
}
if(my_array[0] == 'f'){
firstLetter = 6
}
if(my_array[0] == 'g'){
firstLetter = 7
}
if(my_array[0] == 'h'){
firstLetter = 8
}
if(my_array[0] == 'i'){
firstLetter = 9
}
if(my_array[0] == 'j'){
firstLetter = 10
}
if(my_array[0] == 'k'){
firstLetter = 11
}
if(my_array[0] == 'l'){
firstLetter = 12
}
if(my_array[0] == 'm'){
firstLetter = 13
}
if(my_array[0] == 'n'){
firstLetter = 14
}
if(my_array[0] == 'o'){
firstLetter = 15
}
if(my_array[0] == 'p'){
firstLetter = 16
}
if(my_array[0] == 'q'){
firstLetter = 17
}
if(my_array[0] == 'r'){
firstLetter = 18
}
if(my_array[0] == 's'){
firstLetter = 19
}
if(my_array[0] == 't'){
firstLetter = 20
}
if(my_array[0] == 'u'){
firstLetter = 21
}
if(my_array[0] == 'v'){
firstLetter = 22
}
if(my_array[0] == 'w'){
firstLetter = 23
}
if(my_array[0] == 'x'){
firstLetter = 24
}
if(my_array[0] == 'y'){
firstLetter = 25
}
if(my_array[0] == 'z'){
firstLetter = 26
}
if(my_array[size] == 'a'){
lastLetter = 1
}
if(my_array[size] == 'b'){
lastLetter = 2
}
if(my_array[size] == 'c'){
lastLetter = 3
}
if(my_array[size] == 'd'){
lastLetter = 4
}
if(my_array[size] == 'e'){
lastLetter = 5
}
if(my_array[size] == 'f'){
lastLetter = 6
}
if(my_array[size] == 'g'){
lastLetter = 7
}
if(my_array[size] == 'h'){
lastLetter = 8
}
if(my_array[size] == 'i'){
lastLetter = 9
}
if(my_array[size] == 'j'){
lastLetter = 10
}
if(my_array[size] == 'k'){
lastLetter = 11
}
if(my_array[size] == 'l'){
lastLetter = 12
}
if(my_array[size] == 'm'){
lastLetter = 13
}
if(my_array[size] == 'n'){
lastLetter = 14
}
if(my_array[size] == 'o'){
lastLetter = 15
}
if(my_array[size] == 'p'){
lastLetter = 16
}
if(my_array[size] == 'q'){
lastLetter = 17
}
if(my_array[size] == 'r'){
lastLetter = 18
}
if(my_array[size] == 's'){
lastLetter = 19
}
if(my_array[size] == 't'){
lastLetter = 20
}
if(my_array[size] == 'u'){
lastLetter = 21
}
if(my_array[size] == 'v'){
lastLetter = 22
}
if(my_array[size] == 'w'){
lastLetter = 23
}
if(my_array[size] == 'x'){
lastLetter = 24
}
if(my_array[size] == 'y'){
lastLetter = 25
}
if(my_array[size] == 'z'){
lastLetter = 26
}
var colorNumber:int = Math.round((((size)(firstLetter))/lastLetter));
if (colorNumber == 1) {
input2.text = "Black";
}
if (colorNumber == 2) {
input2.text = "Red";
}
if (colorNumber == 3) {
input2.text = "Orange";
}
if (colorNumber == 4) {
input2.text = "Yellow";
}
if (colorNumber == 5) {
input2.text = "Green";
}
if (colorNumber == 6) {
input2.text = "Blue";
}
if (colorNumber == 7) {
input2.text = "Indigo";
}
if (colorNumber == 8) {
input2.text = "Pink";
}
if (colorNumber == 9) {
input2.text = "Violet";
}
if (colorNumber == 10) {
input2.text = "Gray";
}
if (colorNumber == 11) {
input2.text = "White";
}
if (colorNumber == 12) {
input2.text = "Gold";
}
if (colorNumber == 13) {
input2.text = "Silver";
}
if (colorNumber == 14) {
input2.text = "Brown";
}
}