Statics don’t override. Why not make it an instance getter?
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
Guilherme Blanco
Sent: Tuesday, September 16, 2008 2:18 PM
To: [email protected]
Subject: [flexcoders] Reaching subclass constant inside base class (similar to
self.CONSTANT)
Hi,
I have this implementation in my base class:
BaseSelector.mxml:
public static var MODULE:String = "core.dialogs.BaseDialog";
protected function handleSelectClick(event:MouseEvent):void
{
Environment.loadModule(BaseSelector.MODULE, function (e:ModuleEvent):void
{
// Dialog creation
var dialog:* = UIComponent(e.module.factory.create());
dialog.multipleSelection = multipleSelection;
assignDialogHandlers(dialog);
PopUpManager.addPopUp(dialog, Environment.getApplication(), true);
PopUpManager.centerPopUp(dialog);
}, true);
}
As you may see, I have a constant being defined in base class.
Each subclass defines a new MODULE name, and the handleSelectClick
need to be able to load it and instantiate a new Dialog component
(BaseSelector.MODULE).
So imagine I have a CompanySelector.mxml, which extends from BaseSelector.mxml:
public static var MODULE:String = "app.dialogs.CompanyDialog";
And nothing else.
The button event listener (handleSelectClick) should be able to
recognize the MODULE defined in subclass and define the subclass one
to be loaded.
I tried it by several ways to achieve the same thing as "self" in some
known languages, without success.
Has anyone any ideas how to do that?
Regards,
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: [EMAIL PROTECTED]<mailto:guilhermeblanco%40hotmail.com>
URL: http://blog.bisna.com
Rio de Janeiro - RJ/Brazil