I'm pretty new to this so I'm probably missing something. Basically
what I'm trying to achieve is a flex app that has unlimited views.
I have declared a viewstack in my ModelLocator and I addChild,
removeChild and selectChild as needed.
Right now I have an empty viewstack control in my application. I
use event listeners that are attached to the model.appViews to
manipulate the viewstack (appStack). Is there any way to somehow
just bind appStack to model.appViews and avoid this extra code?
private function initApp():void{
//listen for changes to the viewstack control in modelLocator
model.appViews.addEventListener
(mx.events.ChildExistenceChangedEvent.CHILD_ADD,
updateStack);
}
private function updateStack(event:ChildExistenceChangedEvent):void{
//when appViews gets new child update viewstack here
appStack.addChild(event.relatedObject);
}
//using this to test addChild function from button click
private function addToStack():void{
var login2:Login = new Login();
//for some reason addchild() dies here, ChildAt() works
model.appViews.addChildAt(login2,0);
}
...
<mx:ViewStack id="appStack" />
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/