1 Reply Latest reply on Jul 6, 2009 6:00 AM by Ned Murphy

    Error #1063: Argument count mismatch. Expected 1, got 0.

    keithwoods

      I'm trying to call a TweenEvent function which is placed in another class from my Document Class.

       

       

      ActionScript Code:
      ball[i].tweenX();


      However, the following error message is appearing...

       

       

      ActionScript Code:
      Error #1063: Argument count mismatch on Ball/tweenX(). Expected 1, got 0.


      I'm guessing I need to include something in the parentheses when I call .tweenx();, but I'm not too sure what?!

       

      Here's the Tween Event function in the Ball class as well if it helps.

      ActionScript Code:
      public function tweenX(event:TweenEvent):void
              {
                  var randomXBoundary = (xBoundary[int(Math.random() * xBoundary.length)]);
                 
                  myTweenX = new Tween(this, "x", None.easeOut, this.x, randomXBoundary, 10, true);
                  trace("tweenX function for " + this + " has been called and is heading for" + randomXBoundary + " x pos");
                  myTweenX.addEventListener(TweenEvent.MOTION_FINISH,tweenX);
              }//end of tweenX function
        • 1. Re: Error #1063: Argument count mismatch. Expected 1, got 0.
          Ned Murphy Adobe Community Professional & MVP

          There is a slight conflict of interests so to speak in that you want to call the same function in two different ways... with and without the event argument being passed.

           

          What you probably need to do is separate the tweening function from the event handler function...

           

          public function tweenX():void {


                      var randomXBoundary = (xBoundary[int(Math.random() * xBoundary.length)]);
                     
                      myTweenX = new Tween(this, "x", None.easeOut, this.x, randomXBoundary, 10, true);
                      trace("tweenX function for " + this + " has been called and is heading for" + randomXBoundary + " x pos");
                      myTweenX.addEventListener(TweenEvent.MOTION_FINISH, tweenXEvt);
          }

           

           

          public function tweenXEvt(event:TweenEvent):void {


                      tweenX();

          }