Copy link to clipboard
Copied
can you help me with this. this error pop up when i run my fla file.
TypeError: Error #1006: value is not a function.
at mdas_fla::MainTimeline/ans()
this is my code:
import flash.events.*;
//import flashx.textLayout.conversion.PlainTextExporter;
equal_btn.addEventListener(MouseEvent.CLICK, ans);
function ans(event:MouseEvent):void
{
var op:Array = new Array(String[10]);
var num:Array = new Array(Number[10]);
var hold:String;
//result_txt.text = input_txt.text;
hold = input_txt.text;
var g:int = 0; var ctr:int = 0; var ctr2:int = 0; var str:String="";
while(g < hold.length)
{
if( hold.charAt(g) == '+' || hold.charAt(g) == '-' || hold.charAt(g) == '*' || hold.charAt(g) == '/')
{
op[ctr]= "" + hold.charAt(g);
//trace(op[ctr]);
ctr++; ctr2++; str="";
}
else
{
str += "" + hold.charAt(g);
num[ctr2]= parseInt(str);
//trace(num[ctr2]);
}
g++;
}
var pl:int =0; var val:Number = 0;
for(var a:int = 0; a<op.length(); a++)
{
try
{
if(op == '*')
{
num[pl+1] = num[pl] * num[pl+1];
}
else if(op == '/')
{
num[pl+1] = num[pl] / num[pl+1];
}
else if(op == '+')
{
num[pl+1] = num[pl] + num[pl+1];
}
else
{
num[pl+1] = num[pl] - num[pl+1];
}
}
catch(e:Error )
{
val = num[pl];
break;
}
pl++;
}
//trace(val);
result_txt.text = "" + val;
}
pls.. help me to solve this problem....
length() should be length. ie, the array class has a length property, not method. flash thinks you're trying to define a new function, length().
p.s. while debugging, click file>publish settings>swf and tick "permit debugging" so the problematic line number of your error(s) is in the error messages. that makes it a lot quicker to debug your code.
Copy link to clipboard
Copied
length() should be length. ie, the array class has a length property, not method. flash thinks you're trying to define a new function, length().
p.s. while debugging, click file>publish settings>swf and tick "permit debugging" so the problematic line number of your error(s) is in the error messages. that makes it a lot quicker to debug your code.
Copy link to clipboard
Copied
Thank you for answering my question.
now i can continue my coding thanks a lot dude ![]()
Copy link to clipboard
Copied
you're welcome.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more