views:

19

answers:

2

Hi!

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, so i think it is not possible :).

+2  A: 

No sorry, not possible. Just like you can't put HTML in JavaScript (without it being a string).

TandemAdam
A: 

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.

hering