Flex 4 syntax in actionscript ...?
One (dumb) question:
Is it possible to use flex 4 syntax declaration inside of a actionscript method? For example, something like that:
private function buildContent() : void {
<s:Label id="aLabel">
}
Thanks.
P.S. I couldn't find any reference about this,开发者_StackOverflow so i think it is not possible :).
No sorry, not possible. Just like you can't put HTML in JavaScript (without it being a string).
The syntax isn't "Flex 4 syntax" but "MXML".
You can achieve what you want, while writing:
private function buildContent() : void {
var label:Label = new Label();
}
The syntax <s:Label />
represents an spark:components:Label
object.
精彩评论