0

I made a class so that I can cut some from a class and store the extra code in this new class

package  {

    public class mainSetup extends Main{

        public function mainSetup() {
             trace("I extend the main class");
        }

    }

}

But when I call the function inside my main class, I get the error, incorrect number of arguments, expected 1. Not sure how to fix this.

package  {
    import flash.display.MovieClip;

    public class Main extends MovieClip{

        public function mainSetup() {
             mainSetup();
        }

    }

}
  • 4
    Well for starters, inside `Main`, the call to `mainSetup` refers to the function defined within `Main`. In its current state calling Main.mainSetup() will cause a stack overflow. But within the `mainSetup` class `mainSetup()` is the constructor function. It would normally only be called when creating a new instance of the `mainSetup` class. The code you've got here is rather confusing because you've called your class and your function the same name. Conventionally, `ClassNames` are capitalized while `functionNames` are not. – Patrick Gunderson Jan 10 '14 at 17:55
  • Oh nuts! I deserve a hit on the head. I see my mistake. – Jr. Mathews Jan 10 '14 at 18:10
  • 1
    What was it, for future searchers? – Patrick Gunderson Jan 10 '14 at 18:48

0 Answers0