Hello,

I've created a custom class:

LiquidObject extends Sprite

I then create several instances of LiquidObject and add them as children to a parent Sprite.

If I cycle through and trace the children as such:

for (var i:int=0;i<parent.numChildren;i++) {
        trace(parent.getChildAt(i));
}

Each trace shows the correct type of object:

[object LiquidObject]

When I tried to access a property specific to LiquidObject (LiquidObject.selected) it does not recognize this to be a property because it thinks it's dealing with a general Sprite. So, I attempt to coerce to type LiquidObject as such:

for (var i:int=0;i<parent.numChildren;i++) {
        trace(LiquidObject(parent.getChildAt(i)).selected);
}

Unfortunately, I receive an error stating that I can't coerce type Sprite to LiquidObject. I would think that this would be allowed since (a) LiquidObject extends Sprite and (b) parent.getChildAt(i) is already presenting a type LiquidObject in the trace.

Any suggestions would be appreciated.

Thanks in advance.
Paul




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to