ForumsProgramming ForumConfused?

10 2878
alex57834
offline
alex57834
88 posts
445

I have got the error
C:\\Users\\Alex The Best\\Desktop\\Golden Catch\\Classes\\MainGame.as, Line 28 1137: Incorrect number of arguments. Expected no more than 0.

package {

import flash.display.MovieClip;

public class GoldBar extends MovieClip {

public var xSpeed:Number;
public var ySpeed:Number;
public var randomX:Number;


public function GoldBar(startX:Number, startY:Number):void
{

randomX:Number = Math.random()*550;

startX = randomX;
startY = -20;

xSpeed = 0.
ySpeed = 3.
}

public function moveDown():void
{
y = y + ySpeed;
}

}

}

package {

import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;

public class MainGame extends MovieClip {

public var army:Array;
public var goldBar:GoldBar;
public var gameTimer:Timer;

public function MainGame()
{
army = new Array();

gameTimer = new Timer(25);
gameTimer.addEventListener(TimerEvent.TIMER, onTick);
gameTimer.start();

}

public function onTick(e:TimerEvent):void
{
if( Math.random () < 0.08 )
{
public var newGoldBar = new GoldBar(startX ,startY);
army.push(newGoldBar);
addChild (newGoldBar);

for each (var goldBar:GoldBar in Army)
{
goldBar.moveDown();
}
}
}

}

}

  • 10 Replies
Showing 16-15 of 10