hi guys
i have 3 classes in the library (external classes) and 1 document class called Main
and iam getting these errors all the time i dont know why
ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at Main()
ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at Main()
ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at Main()
ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at Main()
ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at Main()
ArgumentError: Error #1063: Argument count mismatch on tree1/onAdded(). Expected 0, got 1.
at flash.display::DisplayObjectContainer/addChild()
at Main()
here are the classes code (the external classes ) in the lib
MAINMAP1 class
package
{
import flash.system.System;
import flash.system.fscommand;
import flash.display.MovieClip;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Stage;
public class MAINMAP1 extends MovieClip {
var vx:int = 0
var vy:int = 0
public function MAINMAP1(){
addEventListener(Event.ADDED_TO_STAGE, onAdded)
}
public function onAdded (event:Event):void {
}
}
}
tree1 class
package{
import flash.system.System;
import flash.system.fscommand;
import flash.display.MovieClip;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Stage;
public class tree1 extends MovieClip{
public function tree1 (){
addEventListener(Event.ADDED_TO_STAGE, onAdded)
}
public function onAdded (){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event){
{
}
}
}
}
HERO class
package{
import flash.system.System;
import flash.system.fscommand;
import flash.display.MovieClip;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Stage;
public class HERO extends MovieClip{
private var vx:int = 0;
private var vy:int = 0;
public function HERO (){
addEventListener(Event.ADDED_TO_STAGE, onAdded)
}
public function onAdded (event:Event):void {
gotoAndStop(3)
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp);
}
public function onEnterFrame(event:Event){
x += vx
y += vy
}
public function onKeyDown(event:KeyboardEvent){
if (event.keyCode == Keyboard.LEFT){
gotoAndStop(2)
vx = -5
}
if (event.keyCode == Keyboard.RIGHT){
gotoAndStop(1)
vx = 5
}
if (event.keyCode == Keyboard.DOWN){
vy = +5
gotoAndStop(6)
}
if (event.keyCode == Keyboard.UP){
vy = -5
}
}
public function onKeyUp(event:KeyboardEvent){
if (event.keyCode == Keyboard.LEFT ||event.keyCode == Keyboard.RIGHT ){
vx= 0;
}
if (event.keyCode == Keyboard.UP ||event.keyCode == Keyboard.DOWN ){
vy= 0;
}
}
}
}
THE DOCUMENT CLASS (Main)
package {
import flash.system.System;
import flash.system.fscommand;
import flash.display.MovieClip;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Stage;
public class Main extends MovieClip {
var mainmap1:MAINMAP1 = new MAINMAP1;
public function Main() {
addChild(mainmap1);
}
}
}
done
the program running but there are errors in the output i couldn.t get it
help me please
thank you
North America
Europe, Middle East and Africa
Asia Pacific