creationPolicy is all about performance and nothing to do with data, and especially nothing to do with whether your app works or not. Your app should be able to handle that attribute changing, just as well as it can handle a style change.
We typically use commands for switching views. The command can pass the view whatever data it needs or else first listen for its initialize() event if it is not ready yet.
Here's a sketch of a base class you can extend:
public class LaunchViewCommand implements ICommand {
protected var stateParent:UIComponent;
protected var stateName:String;
protected var view:UIComponent;
public function LaunchViewCommand (
stateParent:UIComponent,
stateName:String,
view:UIComponent)
{
this.stateParent = stateParent;
this.stateName = stateName;
this.view = view;
}
public function execute():void{
stateParent.currentState = stateName;
if(view.initialized){
initView();
}else{
view.addEventListener(FlexEvent.INITIALIZE, onViewInit);
}
}
protected function onViewInit(e:FlexEvent):void{
initView();
}
protected function initView():void{
// set params on the view here....
}
}
Peter
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Software development tool | Software development | Software development services |
Home design software | Software development company |
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___