Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash 错误1137:参数数量不正确。应不超过0_Flash_Actionscript 3_Oop - Fatal编程技术网

Flash 错误1137:参数数量不正确。应不超过0

Flash 错误1137:参数数量不正确。应不超过0,flash,actionscript-3,oop,Flash,Actionscript 3,Oop,我在这里发现了一个错误,我应该在大括号之间的构造函数中键入什么 将函数调用到主时间线 公共功能创建(){ 这是我在fla文件中的代码 //var createClass:creation = new Circle( this ); 构造器 package { import flash.display.InteractiveObject; import flash.text.TextField; import flash.text.TextFormat; import flash.displ

我在这里发现了一个错误,我应该在大括号之间的构造函数中键入什么 将函数调用到主时间线
公共功能创建(){

这是我在fla文件中的代码

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

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));
        }
 }
包{
导入flash.display.InteractiveObject;
导入flash.text.TextField;
导入flash.text.TextFormat;
导入flash.display.MovieClip;
公共类创建扩展了MovieClip{
//全局变量
公共函数创建():void{
//构造代码

例如(i=0;i在创建类的新实例时调用类构造函数。在您的情况下,createClass()不仅是错误的,而且是冗余的。还调用了构造函数

现在,如果要在特定帧上调用该类的方法

//calling the class constructor var myClass:MyClass = new MyClass(); //calling a class method myClass.myMethod(); //调用类构造函数 var myClass:myClass=newmyclass(); //调用类方法 myClass.myMethod(); 好的,错误表明一个方法需要一个参数,如果它不是你的构造函数,你将不得不寻找其他地方。要调试你的应用程序,转到调用的第一个函数,检查它,如果确定,转到第二个函数等等。在你的情况下,这将是createCustomTextField()。这可能是一个漫长的过程,因此其中一种方法是简化代码,将代码分解为更小的部分,并尝试确定代码的分解位置

例如,您可以尝试这样做,如果出现错误,请转到createCustomTextField并尝试类似的操作,即将函数拆分为较小的部分,直到找到一个中断的部分

public function creation():void { first1[0]= createCustomTextField(0,(i*100),75,45); } 公共函数创建():void{ first1[0]=createCustomTextField(0,(i*100),75,45); }
感谢您的回答,当我编写creation()时;只有此错误出现1136:参数数量不正确。应为1。您的创建构造函数似乎需要一个参数。请检查编辑的答案我尝试过,但另一个错误1137:参数数量不正确。应为不超过0。出现此错误时,我输入了构造函数代码:“参数的数量不正确。应为1”,如果您得到了行号,您能说出该行上的内容吗?从您的代码中,我只能看出您的构造函数不需要参数。