ForumsProgramming ForumIncorrect number of arguments

8 14358
alex57834
offline
alex57834
88 posts
Nomad

Alright got this error
Classes\\Document.as, Line 9 1136: Incorrect number of arguments. Expected 1.
and this.
Classes\\Document.as, Line 1 5000: The class 'Document' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

here are the classes
the document class is the document class

package {

import flash.display.MovieClip;

public class Document {

public function Document()
{
avatar();
trace("Document Class Working"
}

}

}


and the avatar class

package {

import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;

public class avatar extends MovieClip {

private var _vx:Number;
private var _halfWidth:Number;
private var previousKey:uint;

public function avatar():void
{
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}

private function onAddedToStage(event:Event):void
{
this._vx = 0;
this._halfWidth = this.width / 2;
this.previousKey = Keyboard.RIGHT;

//add Event Listeners

stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyboardUp);
this.addEventListener(Event.ENTER_FRAME, onEnter);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}

private function onRemovedFromStage(event:Event):void
{
this.removeEventListener(Event.ENTER_FRAME, onEnter);
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function onKeyboardDown(event:KeyboardEvent):void
{

//this tells how mnay to go side to side and tells it how to move
var currentKey:uint = event.keyCode;

if (event.keyCode == Keyboard.LEFT)
{
if (currentKey != _previousKey)
{
_previousKey = currentKey;
this.scaleX *= -1;
}

_vx + -4;
}

if (event.keyCode == Keyboard.RIGHT)
{
if (currentKey != _previousKey)
{
_previousKey = currentKey;
this.scaleX *= -1;
}
_vx + 4;
}
}
private function onKeyboardUp(event:KeyboardEvent):void
{
if (Keyboard.keyCode == Keyboard.LEFT || Keyboard.keyCode == Keyboard.RIGHT)
{
_vx = 0;
}
}
private function onEnter(event:Event):void
{
this.x += _vx;
checkStageBoundries();
}
private function checkStageBoundries():void
{
//get if statements to show if its going off the stage and stop it

if (this.x - halfWidth < 0)
{
this.x = 0 + halfWidth;
}
else if (this.x + halfWidth < 0)
{
this.x = stage.stageWidth - halfWidth;
}
}

}

}

  • 8 Replies
Showing 211-210 of 8