开发者

error 1137: Incorrect number of arguments. Expected no more than 0

i found the error here what should i type in the constructor function between the braces to call the function to the main time line

public function creation() {

that's my code in the fla file

//var createClass:creation = new Circle( this ); 

the constructor

package  {
import flash.display.InteractiveObject;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.display.MovieClip;


public class creation extends MovieClip {

    // global variables
            public function creation():void {
            // constructor code
            for (i= 0 ; i<= 4; i++)
    {       first1[i]= createCustomTextField(0,(i*100),75,45);
            op[i]= createCustomTextField(150,(i*100),75,45);
            second[i]= createCustomTextField(300,(i*100),75,45);
            res[i]= createCustomTextField(450,(i*100),75,45);
            if (operation_Count == 1)
        {
            op[i].text = "+";
        }   else if (operation_Count == 2)
  开发者_如何转开发      {   
            op[i].text = "-";
        }else if (operation_Count == 3)
        {   
            op[i].text = "*";
        }else if (operation_Count == 4)
        {   
            op[i].text = "/";
        }
            first1[i].text = String(k1[i]=Math.round(Math.random()*10));
            second[i].text = String(k2[i]=Math.round(Math.random()*10));
        }
 }


You call a class constructor when you create a new instance of the class. In your case , createClass() is not only wrong but it's also redundant. The constructor has alsready been called.

now, if you want to call a method of that class on a specific frame

//calling the class constructor
var myClass:MyClass = new MyClass();

//calling a class method
myClass.myMethod();

ok, the error says that a method expects an argument, if it's not your constructor, you will have to look elsewhere. to debug your app, go to the first function that's called , check it, if ok, go to the second one etc... in your case , that would be createCustomTextField(). this can be a long process , so one of the ways is to simplify , break down your code in smaller parts and try to identify where it breaks

You could try this for instance , if there's an error , go to createCustomTextField and try something similar , namely split your function in smaller parts until you find the one that breaks...

public function creation():void {

    first1[0]= createCustomTextField(0,(i*100),75,45);

 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜