View Full Version : Runtime Creation of Components

03-09-2007, 03:19 PM
Alright, I feel really silly that after 2.5 years of doing Flash I still don't know how to do this (or even if it's possible). All my searching has been in vain. Today I decided that I must find out the answer to this.

How do I instantiate a component (e.g., a RadioButton) dynamically from AS, but not from another component - just attaching it to a movieclip? Somehow I just can't seem to find the answer to this!!! :)

03-13-2007, 04:55 AM
Amazing, it's not just me then? Nobody knows the answer to this question? Wow, this is like The Great Actionscript Conspiracy!

03-13-2007, 07:21 AM
can u explain your question ??
is it that u want to initialise a UI object dynamically??
it can be done using createClassObject(className, instanceName, depth, initObject):)


03-13-2007, 07:40 AM
Wow, I tried it and it did work! :) I swear I tried this at least 5 times before and it didn't work! Probably the first couple of times it was because I didn't have the component in the library, but I could swear I went through this process before. Damn! :) ;) Somehow I came to the conclusion that createClassObject was a method of UIObject/UIComponent and could not be invoked from a MovieClip.

Thanks, Anand, this really made my day. :)