programmatically add views to a viewstack flex
Posted
by dubbeat
on Stack Overflow
See other posts from Stack Overflow
or by dubbeat
Published on 2010-06-10T13:46:15Z
Indexed on
2010/06/10
13:52 UTC
Read the original article
Hit count: 267
Hi,
I'm trying to figure out how to in as3 (not mxml) add views to a view stack.
For example I have a view component like so
package components.screens
{
import mx.controls.Label;
import mx.core.UIComponent;
public class HomeScreen extends UIComponent
{
private var l:Label=new Label()
public function HomeScreen()
{
super();
l.text="home";
addChild(l)
}
}
}
I've being trying to add it to a viewstack in the following way
var myStack:ViewStack= new ViewStack();
mystack.addChild(homeScreen)
This does not work. Whats the correct way?
I'm aware I have to assign ID's but for now I just want to get the view in there
© Stack Overflow or respective owner