[COLOR=“Green”][SIZE=4]SOLVED - see thread[/SIZE][/COLOR]
[COLOR=“DarkRed”]ArgumentError: Error #1063: Argument count mismatch on Cars_fla::MainTimeline/addCar(). Expected 0, got 1.[/COLOR]
I understand that it expects 0. But I don’t understand from where it get’s 1 parameter…?
[SIZE=“2”][COLOR=“RoyalBlue”]Main timeline code[/COLOR][/SIZE]
import Car;
import flash.display.MovieClip;
import flash.events.MouseEvent;
add_btn.addEventListener(MouseEvent.CLICK, addCar);
function addCar()
{
var car1:Car = new Car( 1, 1, mcVolvo)
addChild(car1);
car1.x = 200;
car1.y = 200;
}
[COLOR=“RoyalBlue”][SIZE=“2”]Car class code[/SIZE][/COLOR]
package
{
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.text.TextField;
public class Car extends MovieClip
{
private var _weight:Number;
private var _topSpeed:Number;
private var _movieclip:MovieClip;
function Car( weight:Number, topSpeed:Number, movieclipClass:Class )
{
_weight = weight;
_topSpeed = topSpeed;
_movieclip = MovieClip(new movieclipClass());
this.addChild(_movieclip);
}
}
}