your class Car looks okay and so does you syntax to instantiate it and method 
call.

try this. Create an Application(test.mxml) in the same folder location as your 
Car.as file.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
        
        <mx:Button label="test" click="test()"/>
        <mx:Script>
                <![CDATA[
                        public function test():void
                        {
                                var yugo:Car = new Car(10, "North");
                                yugo.showVelocity();
                        }
                ]]>
        </mx:Script>    
</mx:Appllication>


--- In [email protected], "ellistein52" <ellistei...@...> wrote:
>
> ArgumentError: Error #1063: Argument count mismatch on Car(). Expected 2, got 
> 0.
> 
> 
> Here's the code:
> 
> package {
> public class Car {
> private var speed:Number;
> private var direction:String;
> public function Car(speed:Number,direction:String) {
> this.speed = speed;
> this.direction = direction;
> }
> public function showVelocity():void {
> trace("The car's velocity is "+this.speed
> +" KPH "+this.direction);
> }
> public function crash():void {
> trace("Boom!");
> }
> }
> }
> 
> Then I built a class inside of the package Car class and called the
> method:
> 
> var yugo:Car = new Car(10, "North");
> yugo.showVelocity();
>


Reply via email to