Updates to Car Example (Interface and ASDoc Comments)

The Flex object composition car example I recently created got some updates. I changed CompositionBase into a interface instead inheriting the class (thx Marcus for the heads up on that one). I also went through all the code and style the source code just like the Flex source. You find the code with ASDoc compliment comments and Flex styled sections.

With these updates the set of Car examples classes provide the following benefits:
Object inheritance

Actionscript:
public class Car extends Image

Object composition
Car contains Engine,Tires, and Steeringwheel

Actionscript:
public function Car()
{
super();
_engine = new Engine();
_steeringWheel = new SteeringWheel();
_tires = new Array();
_tires.push( new Tire( "RearLeft" ) );
_tires.push( new Tire( "RearRight" ) );
_tires.push( new Tire( "FrontLeft" ) );
_tires.push( new Tire( "FrontRight" ) );
}

Interfaces - Engine,Tires, and SteeringWheel implement CompositionBase

ASDoc comments - Seen in the use of /** @public .... */ styled comments

Adobe Flex source code section style - Seen in the use of //-------- styled comments to break up "Constructor", "Variables", "Properties", "Methods", and other specific section styled blocks

Custome Event - CarMonitorEvent

Dispatching Events

Actionscript:
parentObject.dispatchEvent( new CarMonitorEvent( "Engine started" ) );

Getter/Setters

Actionscript:
public function set parentObject( value:UIComponent ):void {
_parentObject = value;
}
public function get parentObject():UIComponent {
return _parentObject;
}

There are probably more but thats good enough for the highlights.

For the full code example click here.

You can view the source here.

Object Composition versus Inheritanance and other good reading:
Composition versus Inheritanance
Object composition