Multiple inheritance is actually possible with AS3, despite popular belief that it's not supported.  It's not "true" multiple inheritance int he C++ sense of the word, and you can't list more than one class as a super class via extends.. but theres a way to get the job done in AS3.

I have a weblog post queued up to go out this week, but I'll push it up to today and try to get it out over lunch for you to explain how to simulate it.  I don't recommend the approach be taken often, but there are certain use cases where it's extremely useful.  It'll solve your problem, give me just a few to get it on the old blog.. :-)

-d

Daniel Freiman wrote:

I know that strictly speaking there is no way for an object to inherit from two superclasses, but doesn't anyone know a good workaround to simulate this in actionscript?  Being able to write code in interfaces instead of just method definitions would be a perfect solution to this problem, but a simple test showed me that wasn't possible.  Anyone have any thoughts?

For those who are confused at what I am asking, a contrived but simple example:
Let's say I'm trying to layout a user interface.  I have two types of controls (ComboBoxes, Buttons).  When doubleclicked I want a control to report it's x value so a user can determine if the controls are aligned by x value.  Right now what I'm doing is implementing this ability in a subclass of combobox and of button, and then extending these new classes when I want to create controls with custom functionality.  This is acceptable except I keep adding functionality to my custom superclasses.  Let's say I want to now want the controls to also report their y position.  I have to go back and both my new combobox and button classes, which is annoying and doubles my code.

Any thoughts on a good way around this problem?

thanks

- Dan


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to