Page 1 of 1

Return to same card in app

Posted: Fri Dec 16, 2011 10:50 pm
by Tester2
I'm probably just overlooking it in the forums/manual, but what code do I need to enter (and where), to have my user return to the same card in the app once they leave? (ie: press Home button twice or click on link that exits app to Safari)

Thanks bunches!

-Tester2

Re: Return to same card in app

Posted: Sat Dec 17, 2011 1:34 am
by Dixie
Tester 2...

I have attached a stack that contains 3 cards... If you leave the stack say on card 2, when you open the stack again you will be taken to card 2 , or whichever card you chose to leave the stack.

Scripts are in the stack script...

hope it helps...

Dixie

Re: Return to same card in app

Posted: Mon Dec 19, 2011 9:14 pm
by Tester2
Dixie,

Thanks so much for the sample file! ;)

I'm currently dissecting it, and came across a question.

You use the following in the stack script:

put URL "file:trackCard" into whichCard
go card whichCard

Is "whichCard" a custom property or field...and how is it defined?

Thanks so much!

-Tester2

Re: Return to same card in app

Posted: Mon Dec 19, 2011 10:09 pm
by Jellicle
It's simply a variable. You know about variables, don't you?

Re: Return to same card in app

Posted: Mon Dec 19, 2011 10:15 pm
by Dixie
tester2..

Code: Select all

      if there is a file "trackCard" then
         put URL "file:trackCard" into whichCard
         go card whichCard
      end if
every time a user visits a card, the number of that card is written to the file 'trackCard'. (see the openCard handler). When the stack is restarted the number of the card that was last put into the file 'trackCard' is placed into a variable, which I called, whichCard...

Then the user is taken to that card with

Code: Select all

go card whichCard
be well,

Dixie

Re: Return to same card in app

Posted: Mon Dec 19, 2011 10:45 pm
by Tester2
Ahh...it makes sense now.

Is there a way that the file 'trackCard' gets reset?

Like, say I restart my phone...is there a way to tell this file to clear itself, so that the app opens as if it was the first time the user opened it?

Thanks.

-Tester2

Re: Return to same card in app

Posted: Tue Dec 20, 2011 9:14 pm
by Dixie
Tester2...

There is no way to do this with liveCode as your 'app' lives in its own 'sandbox'...

Dixie