views:

59

answers:

1

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));
        }
 }
+1  A: 

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);

 }
PatrickS
thanks for your answer , when i write creation(); only this error appear 1136: Incorrect number of arguments. Expected 1.
Maged
It seems your creation constructor requires one argument. Check the edited answer
PatrickS
i tried it but another error 1137: Incorrect number of arguments. Expected no more than 0. i put the constructor code
Maged
When you get this error: "Incorrect number of arguments. Expected 1" , do you get the line number, can you tell what's on that line. From your code I can only tell that your constructor doesn't require an argument.
PatrickS