You would write AS3 code that uses the 'new' operator to create a
component and the addChild() method of a container to add that new
component to its parent, as in
 
var newView:Canvas = new Canvas();
myViewStack.addChild(newView);
 
var textInput:TextInput = new TextInput();
textInput.move(100, 200);
textInput.text = name;
newView.addChild(textInput);
 
var button:Button = new Button();
button.label = "OK";
button.move(100, 300);
nextView.addChild(button);
 
Of course, you'd have to determine which components to create, where to
place them, and what property values to set into them based on your
template info in the DB.
 
- Gordon

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of jjmal27
Sent: Wednesday, November 15, 2006 6:20 PM
To: [email protected]
Subject: [flexcoders] Dynamically adding views to a viewstack



Hi, 
I want to dynamically create views in a viewstack by taking the 
view "template" information from the DB and then drawing my view 
components. The components will hold text and the views should be 
switched by the user clicking on a button or some clickable text. 

I'm new to flex and actionscript so any advice or examples on how to 
go about this would be a great help. 



 

Reply via email to