I've begun development on a isometric game, and have what I thought to be the hard part out of the way - the map generation from external files, screen-to-isometric conversions, etc. However I'm getting stumped on the "easy" stuff.

Basically what I'm trying to do is this. Create a function that will add an object to the map (stage), then add an eventlistener so when it's clicked on, it gets added to the player's inventory. Lets take this sample code:

public function addObjectToWorld(o:IsoObject):void {
   // ...code to add it to the world
  this.addEventListener(MouseEvent.CLICK, onObjectClick);

public function onObjectClick(e:MouseEvent):void {
  // this is where I'm having a problem....
In the 'onObjectClick' function, I'm trying to figure out how to add the object that's being clicked on to an array variable declared in the Main class. I had something like 'event.target.name', but that only gives me a string value of the object. I want to add the actual object to the 'playerInventory' array, so I can use them later on.

As a side note, all the objects that could be clicked on will be classes that extend 'IsoObject', so I was trying to use Polymorphism in my code (ie. all the 'playerInventory' objects were IsoObjects, so they could accept all the items such as ball(), pipe(), etc.), but it wasn't helping me come to an answer.

Any ideas?