Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

TypeError: Error #1006: value is not a function. at mdas_fla::MainTimeline/ans() problem

New Here ,
Aug 07, 2013 Aug 07, 2013

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....

TOPICS
ActionScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 07, 2013 Aug 07, 2013

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.

Translate
Community Expert ,
Aug 07, 2013 Aug 07, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2013 Aug 07, 2013

Thank you for answering my question. now i can continue my coding thanks a lot dude

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2013 Aug 07, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines