I want to replace getStyle('someStyle') in mxml with
private static const SOMESTYLE:String = "someStyle";
[..]
<mx:Image source="{getStyle(SOMESTYLE)}" />
where someStyle is defined in my CSS.
This compiles, but gives me error on runtime: Error #1069: Property SOMESTYLE not found on package.class and there is no default value.
What is the appropriate way to reference to the class constant from the mxml?
edit: I’m using Flex 4.6. This worked just fine in Flex 3.5.
Static variables or methods exist on the class; not on an instance of the class. So you have to reference them using the class name; not the instance name. You did not specify the class name in your code.
Here is some code that shows accessing a static constant inside the same class that defines it. This file is named StaticVariablesInSameClass_SO: