PDA

View Full Version : Interface for DisplayObject?


Flash Gordon
01-02-2008, 07:58 PM
I find myself often making interfaces for custom class that extends Sprite.

var fudcake:IFun = new Bar(); // extends Sprite
//
// later on....
fudcake.x = 20;


However at some point I often need to access a property "fudcake" as a displayobject and not just the interface that I've created. Is there a undocumented IDisplayObject, or is my logic in recasting my "fudcake" bad OO? Or should I just make my own IDisplayObject interface and have IFun extend it?

Currently I just tend to cast fudcake like so DisplayObject(fudcake).x = 20, and get on with life.

dr_zeus
01-02-2008, 08:10 PM
Casting an interface instance as DisplayObject/Sprite/whatever is the way I do it too.

Flash Gordon
01-02-2008, 08:12 PM
Okay, if it's good enough for you, it is good enough for me

Cheers
:)

newblack
01-02-2008, 08:33 PM
i agree that it's fine provided IFun isn't simply imposing other DisplayObject properties/methods...