Again pulling my hair out due to some Flex/AS3 weirdness. The following code does not compile due to error 1120 – Access of undefined property AbstractWizardModel
<mx:HBox id="cntr_buttons" width="100%" horizontalAlign="right">
<mx:Button label="{model.getButtonLabel(AbstractWizardModel.GO_BACK)}" />
</mx:HBox>
The constant is defined (in AbstractWizardModel) as:
[Bindable]
public class AbstractWizardModel extends EventDispatcher
{
public static const GO_BACK : String = "goBack";
...
}
Replacing ‘AbstractWizardModel.GO_BACK’ with ‘”goBack”‘ does the trick, but what was the problem?
Thanks!
PS: Of course I am importing the AbstractWizardModel in the MXML code
Oh man this is so weird..
I found kind of a solution, thanks to all comments, which helped me to get on the right track, but still think this is a bug in Flex.
First of all I have to add that (in my code) the MXML and AbstractWizardModel class are in the same package.
The ‘getButtonLabel()’ function that I am calling is declared as
If I remove that [Bindable..] annotation, the code compiles.
If I leave it there, I have to add an import for class AbstractWizardModel, although it is in the same package. Anyway, that fixes the problem, too.
However 🙂 FB4 removes that import everytime it organizes imports, so that user comment was helpful too.
Happy to hear your thoughts!