// ActionScript 2.0 Document class Car { // Member declarations, Constructor, and other getter and setter methods private var _make:String = null; private var _model:String = null; private var _extColor:String = null; private var _mileage:Number = 0; private var _driveIntervalID:Number = null; private var _icon:MovieClip = null; private function incrementMileage(speed:Number):Void { _mileage += Math.round(Math.random() * speed); moveIcon(); } private function moveIcon():Void { _icon._x = _mileage; updateAfterEvent(); } public function drive(bStartDrive:Boolean):Void { if(bStartDrive) { _driveIntervalID = setInterval(this, "incrementMileage",20,10); }else{ clearInterval(_driveIntervalID); } } function Car(sMake:String,sModel:String,sExtColor:String,mcIcon:MovieClip){ _make = sMake; _model = sModel; _extColor = sExtColor; _icon = mcIcon; } public function get description():String { var sDescription:String = ""; sDescription += "Model: " + _model + newline; sDescription += "Make: " + _make + newline; sDescription += "Exterior Color: " + _extColor + newline; sDescription += "Mileage: " + _mileage + newline; return sDescription; } public function get make():String { return _make; } public function set make(sMake:String):Void { _make = sMake; } public function get model():String{ return _model; } public function set model(sModel:String):Void{ _model = sModel; } public function get extColor():String{ return _extColor; } public function set extColor(sExtColor:String):Void{ _extColor = sExtColor; } public function get mileage():Number{ return _mileage; } }