I need to separate the visual part of a component from the functional part of a component, so that I’m able to replace the visual one with a new one for another platform.
Declaring an instance variable _delegate with the delegate’s interface isn’t a problem. But how Do I forward non-implemented method calls of the visual part to those of the delegate.
What’s the equivalent of PHP’s _call()?
Reading your post I thought of two ways of visual separation from logic. But I’m not sure it is what you want.
One way is to use Code Behind for your visual classes:
The other way of separation in flex 4 (spark) is the use of Skin classes:
Of course you can always use some Framework to help you separate the View from the Model or Controller (MVC):
They might help you implement a useful design pattern to achieve that separation. For example:
Hope this helps,
Blaze