PDA

View Full Version : Is it possible to create UI elements purely in Actionscript 3?



DBA
November 25th, 2009, 07:02 PM
I am familiar with the method of embedding a SWF file in Actionscript and then creating a variable and assigning a corresponding UI element from the SWF.

My question is this:
Is it possible to create and place UI elements like TextFields and SimpleButtons purely with Actionscript without first creating them in a SWF and embedding it?

Thanks in advance.

Krilnon
November 25th, 2009, 07:11 PM
Yes, I mean, what's wrong with just doing something like:


var t:TextField = new TextField();
addChild(t);

? It seems to be pure ActionScript, and you don't need any SWFs other than the one that the ActionScript itself is eventually compiled into.

DBA
November 27th, 2009, 11:40 AM
That works, thanks. I thought it should be that simple but I was being defeated by another bug in my code.