First-Time Initialization problem

Scott Rossi scott at tactilemedia.com
Tue Oct 18 18:18:35 EDT 2005


Recently, David Burgun  wrote:

> Here's something that has been driving me mad for a while now, I've
> managed to work-around it up until now, but now I'd like to know if
> there is a solution to it. I'd like to be able to run an
> Initialization handler in each card of a stack IF AND ONLY IF this is
> the first time the stack has been loaded.
> ...
> Can anyone give me some advice on this?

One way to do it is to set a property on each card every first time it is
viewed, and then check the property whenever you revisit the card, something
like:

  on preOpenCard
    if not the uInitDone of me then
       doMyInitRoutines
       set the uInitDone of me to true
    end if
    doOtherStuff
    ...
  end preOpenCard

You may have to account for other behavior depending on whether your stack
can be saved at any time during its use as properties (init values) will be
saved with the stack.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list