View Full Version : Loading Components in MXML at runtime
zanshin
09-20-2009, 09:03 PM
Lets say I have a Client loaded XML file. They can defined up to five rows (HBox's). If each row is an HBox how do I define a field in that frow as a Link, Label, Textarea, or input at runtime based on a specific clients needs.:confused:
wvxvw
09-20-2009, 09:14 PM
Usually those classes would be already compiled into your SWF, all you will need to do is to implement some logic in parsing the XML and create elements that should display whatever you have in that XML.
zanshin
09-20-2009, 10:31 PM
Ok... My question is how do I create a LinkLabel, textarea, or other on the fly. I'm assuming it will be through actionscript somehow. For Example, on my creationComplete event how would I create an HBox out of the init() function that in a Label or other component.
wvxvw
09-20-2009, 10:43 PM
Well... usually you instantiate ActionScript classes using "new" keyword followed by that class' classname then parens containing constructor arguments. However classes that are used in MXML layout seldom have constructor arguments... But I feel a little weird telling you this, because, if you want to do things using ActionScript you'd have to know the language... and creating class objects is rather a basic task...
zanshin
09-21-2009, 04:44 PM
I understand the basics of actionscript and MXML. When I design a screen I typically add a VBox component from my IDE. However at runtime on the fly would a literally created a class instance of VBox in actionscript and add it using x and y coordinates.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.