Flex / Flash Error 1137

ActionScript Error #1137: Incorrect number of arguments. Expected no more than 0.

ActionScript 3 Error #1137 Description:
AS3 error 1137 is describing the fact that you have entered a parameter that is not supposed to be inside the parenthesis.

Flash Error 1137 Fix:
Remove all parameters from within the parenthesis.

Bad Code:

var fileToLoad:URLRequest = new URLRequest(“cleanhandsworkahsc.swf”)
var myLoader:Loader = new Loader(fileToLoad);
this.addChild(myLoader);

Good Code:

var fileToLoad:URLRequest = new URLRequest(“cleanhandsworkahsc.swf”)
var myLoader:Loader = new Loader();
myLoader.load(fileToLoad);
this.addChild(myLoader);

This should help you resolve Flex / Flash Error #1137

Thanks and as always Happy Flashing

Curtis J. Morley

4 thoughts on “Flex / Flash Error 1137

  1. edit:
    That should be Point(50,50) and new Point(50,50), not aPoint (that is, a variable). If it were a variable then it would exist already and not trigger the problem.

  2. This error will be triggered (and drive you batty) in the following situation:

    Problem code:
    // Point parameter is the problem here
    someFunction(aNumber, aPoint(50,50), aBoolean);
    function someFunction(n:Number, p:Point, b:Boolean) { … }

    This will solve it:
    // need to pass a _new_ Point
    someFunction(aNumber, new aPoint(50,50), aBoolean);

    Also seen elsewheres: copying an addEventListener() with its 5 parameters and changing it to a removeEventListener() with the same 5. An error because removeEventListener takes only two parameters (and optionally a third).

  3. I am getting error 1137, but my constructor clearly needs one argument that is a MovieClip data type how can this be?

    package Mover
    {
    import flash.display.MovieClip;
    import flash.events.Event;

    public class Mover extends MovieClip
    {
    private var targetMC:MovieClip;

    public function Mover(targetMC:MovieClip)
    {
    this.targetMC = targetMC;

    }/* end of constructorn mover */

    private function updatePosition(evtObj:Event):void
    {
    this.targetMC.x++;
    this.targetMC.y++;

    }/* end of function updatePosition */

    public function startMoving():void
    {
    this.targetMC.addEventListener(Event.ENTER_FRAME, this.updatePosition);

    }/* end of function startMoving */

    public function stopMoving():void
    {
    this.targetMC.removeEventListener(Event.ENTER_FRAME, this.updatePosition);

    }/* end of function stopMoving */

    }/* end of Mover class */

    }/* end of package Mover */

  4. I try to pass a parameter (string) to a class on instatiation, but I keep getting the error: 1137: Incorrect number of arguments. Expected no more than 0.

    For testing I try:
    var mythumb:myThumb = new myThumb(“A String”);

    I have a library symbol with a Class name: myThumb
    with a Base Class of CaseThumb which resides in the path com.svdelle.CaseThumb.

    And in the Class I have:
    public function CaseThumb(image:String = “Image URL”):void

    What am I chokin’ on here? Can anyone see my mistake?

    I do the exact same thing on other Classes with no problem, so I think I’m fumbling around with this Class/Base Class thing …

Comments are closed.