[flexcoders] Re: Page States

2008-01-09 Thread John
Simon, could you show an example of this, I am unfortunately new to 
Flex and I am getting used to the nuances of the tool.

TIA

John

--- In flexcoders@yahoogroups.com, simonjpalmer [EMAIL PROTECTED] 
wrote:

 there are lots of ways of making sure that the state of your custom
 controls is managed exactly how you want it.  None of them are
 completely free, you have to put in some effort.  Here are a few:
 
 1) create the control every time it gets accessed.  This will
 guarantee that it retains no state
 2) write a clear() function on the control which makes sure that 
state
 is cleared and the state of all child controls.  Call the clear()
 function either just before the control gets shown or just after you
 retrieve the data and switch out of it.
 3) make sure that data bindings are in place which mean that the
 control's state is always accurate, including null bindings or
 bindings to null.
 
 These are not either/or, you can do all of them - it depends on
 exactly how you want your app to behave and how you want to 
structure
 your code.
 
 Personally I do a lot of 2) and have a clear function called
 preInitialise() on every custom control and I make sure that it gets
 called before the control is shown.  I do all the set-up/clean-up I
 need in preInitialise().  I have this standard across all my 
controls
 and if in doubt preInitialise on the parent will call preInitialise 
on
 the custom controls which are children.  
 
 All of this is manually written code, nothing is for free.
 
 --- In flexcoders@yahoogroups.com, John jpapworth@ wrote:
 
  Erm, yes if that is what it is called. Would this do it for every 
one 
  or just the one you put the code in for?
  
  --- In flexcoders@yahoogroups.com, simonjpalmer simonjpalmer@ 
  wrote:
  
   Are you asking how you clear data state from a custom 
  component/control?
   
   --- In flexcoders@yahoogroups.com, John jpapworth@ wrote:
   
Hi there,

I am fairly new to Flex, so I am in need of quite a lot of 
advice.

I am building some pages that I require them to start from 
the 
beginning rather than retaining their last state, but equally 
I 
  would 
like to be able to have some of my pages to retain their last 
  state.

Thanks

John
   
  
 





[flexcoders] Re: Page States

2008-01-08 Thread simonjpalmer
there are lots of ways of making sure that the state of your custom
controls is managed exactly how you want it.  None of them are
completely free, you have to put in some effort.  Here are a few:

1) create the control every time it gets accessed.  This will
guarantee that it retains no state
2) write a clear() function on the control which makes sure that state
is cleared and the state of all child controls.  Call the clear()
function either just before the control gets shown or just after you
retrieve the data and switch out of it.
3) make sure that data bindings are in place which mean that the
control's state is always accurate, including null bindings or
bindings to null.

These are not either/or, you can do all of them - it depends on
exactly how you want your app to behave and how you want to structure
your code.

Personally I do a lot of 2) and have a clear function called
preInitialise() on every custom control and I make sure that it gets
called before the control is shown.  I do all the set-up/clean-up I
need in preInitialise().  I have this standard across all my controls
and if in doubt preInitialise on the parent will call preInitialise on
the custom controls which are children.  

All of this is manually written code, nothing is for free.

--- In flexcoders@yahoogroups.com, John [EMAIL PROTECTED] wrote:

 Erm, yes if that is what it is called. Would this do it for every one 
 or just the one you put the code in for?
 
 --- In flexcoders@yahoogroups.com, simonjpalmer simonjpalmer@ 
 wrote:
 
  Are you asking how you clear data state from a custom 
 component/control?
  
  --- In flexcoders@yahoogroups.com, John jpapworth@ wrote:
  
   Hi there,
   
   I am fairly new to Flex, so I am in need of quite a lot of advice.
   
   I am building some pages that I require them to start from the 
   beginning rather than retaining their last state, but equally I 
 would 
   like to be able to have some of my pages to retain their last 
 state.
   
   Thanks
   
   John
  
 





[flexcoders] Re: Page States

2008-01-07 Thread simonjpalmer
Are you asking how you clear data state from a custom component/control?

--- In flexcoders@yahoogroups.com, John [EMAIL PROTECTED] wrote:

 Hi there,
 
 I am fairly new to Flex, so I am in need of quite a lot of advice.
 
 I am building some pages that I require them to start from the 
 beginning rather than retaining their last state, but equally I would 
 like to be able to have some of my pages to retain their last state.
 
 Thanks
 
 John





[flexcoders] Re: Page States

2008-01-07 Thread John
Erm, yes if that is what it is called. Would this do it for every one 
or just the one you put the code in for?

--- In flexcoders@yahoogroups.com, simonjpalmer [EMAIL PROTECTED] 
wrote:

 Are you asking how you clear data state from a custom 
component/control?
 
 --- In flexcoders@yahoogroups.com, John jpapworth@ wrote:
 
  Hi there,
  
  I am fairly new to Flex, so I am in need of quite a lot of advice.
  
  I am building some pages that I require them to start from the 
  beginning rather than retaining their last state, but equally I 
would 
  like to be able to have some of my pages to retain their last 
state.
  
  Thanks
  
  John