Have each 'page' of your app extend a base class that has a publicfunction you can call when it becomes visible when the ViewStack changes.
Jeff ________________________________ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of claudiu ursica Sent: Friday, June 26, 2009 5:03 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex View Stack / Component Life Cycle Best practice And you probably want to try to catch that change event on it's propagation phase instead of bubbling phase. C ________________________________ From: Jeffry Houser <j...@farcryfly.com> To: flexcoders@yahoogroups.com Sent: Friday, June 26, 2009 12:08:56 AM Subject: Re: [flexcoders] Flex View Stack / Component Life Cycle Best practice You probably want to run code when the viewStack changes. Look at the ViewStack, I bet there is a change event. martinosaint wrote: > Hi there, > > I have built a multiplage application in Flex with different user roles. I > use a View Stack with a Menu Bar to navigate between the different pages. > > However - each time a page gets opened, I need to do some database calls, > apply User Role settings, etc. in an init() function. This init function may > reference some UI elements of this page. > > I tried to load it with the "creationComplete" event, but this one gets only > triggered once (since the page is not rebuilt each them the view stack shows > it). > > Now I have put it on the "show" event, but this seems not to get triggered > consistently, or before the page is fully created the first time. > > Whats the best practice for this case? > * I have to pass in data > * Call init functions (database calls) > * Manipulate components > > Ideally I would need a way to call init each time the page is loaded and > after all components are created. > > Thanks for your help, > Martin > > > > ------------ --------- --------- ------ > > -- > Flexcoders Mailing List > FAQ: http://groups. yahoo.com/ group/flexcoders /files/flexcoder > sFAQ.txt<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> > Alternative FAQ location: https://share. acrobat.com/ adc/document. do?docid= > 942dbdc8- e469-446f- b4cf-1e62079f684 > 7<https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847> > Search Archives: http://www.mail- archive.com/ flexcoders% 40yahoogroups. > comYahoo<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo>! > Groups Links > > > > > -- Jeffry Houser, Technical Entrepreneur Adobe Community Expert: http://tinyurl. com/684b5h<http://tinyurl.com/684b5h> http://www.twitter. com/reboog711<http://www.twitter.com/reboog711> | Phone: 203-379-0773 -- Easy to use Interface Components for Flex Developers http://www.flextras.com?c=104 -- http://www.theflexshow.com http://www.jeffryhouser.com -- Part of the DotComIt Brain Trust