Hi...
I have a question about the above subject. i am a little confused and need a little clarification
best practices documentation mentions this
"Your concrete Mediator’s constructor will pass its View Component to the superclass and it will be made immediately available internally as a protected property called viewComponent, generically typed as Object."
so for instance, IF i have an mxml component called LoginPanel and its mediator LoginPanelMediator, the constructor for the mediator should like this
...
public function LoginPanelMediator ( viewComponent : Object ) : void
{
super(NAME, viewComponent);
...
}
then the documentation goes on to say
"However it was set, you will frequently need to cast this Object to its actual type, in order to access whatever API it exposes, which can be a cumbersome and repetitive practice."
so like this
protected function get loginPanel() : LoginPanel
{
return viewComponent as LoginPanel;
}
this makes sense...until i start seeing mediator constructors in some of the sample applications like this
public function LoginPanelMediator ( viewComponent : LoginPanel ) : void
{
super(NAME, viewComponent);
...
}
then casted this same old way
protected function get loginPanel() : LoginPanel
{
return viewComponent as LoginPanel;
}
notice the type for the viewComponent in the contructor. this time its not type Object BUT LoginPanel. does it really matter.?? are both implementations right?
Thanks
Kofi