I am trying to create a button with an image and text from an
ActionScript class. NOT from the mxml file. It has to be created
from an .as source.
I cannot find any icon field in the public properties of the
Can anyone tell me how to do this?
A more general answer to your question is that in Flex, there
are true "properties" and there are "style properties".
True properties and style properties are set in MXML with the
propName="propValue" syntax, but in ActionScript, while true
properties use this same syntax, style properties use the
objName.setStyle("propName", "propValue") syntax, and to get the
However, in MXML, even Boolean and number values are enclosed
in double-quotes, but in AS they are not.
If you misspell a style property name in MXML you get an
error, but if you misspell in AS your assignment or reference
simply doesn't work, no error unless you try to use that value
elsewhere and it is incorrect or not set.