Doesn't make sense. I just tried it out and it works for me in an ActionScript project as well.
Clearly, you Car class constructor takes 2 arguments, and its being passed 2 args in the instantiation. If you are using flexbuilder try click Project>Clean (this will build the project like its building for the very first time) If that doesnt work. Try creating a new Flex Project and just add your Car class and my test.mxml class. --- In flexcoders@yahoogroups.com, "ellistein52" <ellistei...@...> wrote: > > > It won't allow me to create anMXML application in a pure Actionscript joject. > So I careted a simple as.script . The problem seems the program itself. After > I finished it and try to compiled it it was showing those same errors way > before I create the AS script to call the method: > public function test():void > { > var yugo:Car = new Car(10, "North"); > yugo.showVelocity( ); > } > > This AS.script returns the same error and the program seems perfect. > > --- In flexcoders@yahoogroups.com, "ellistein52" <ellistein52@> 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(); > > >