Post 1 made on Thursday August 5, 2010 at 10:21 |
alpha Long Time Member |
Joined: Posts: | September 2003 258 |
|
|
If I create an activity with multiple pages. On the First Page , if I have a variable statement like ...
var dog = 20 ;
How can I save ( dog ) into memory and then read ( dog ) when I leave the First Page and enter the Second Page within the same activity ?
|
Project Boredom 2 is here. [Link: mediafire.com]------------------------ Check Version 1 & 2 out in the files section. |
|
Post 2 made on Thursday August 5, 2010 at 11:24 |
Guy Palmer Active Member |
Joined: Posts: | June 2008 648 |
|
|
If you omit the "var" then the variable becomes activity-wide and will therefore still be available when you go to the second page.
|
|
Post 3 made on Thursday August 5, 2010 at 16:46 |
BluPhenix Long Time Member |
Joined: Posts: | December 2008 371 |
|
|
Or you declare the variables at the activity level.
If you want really global variables use setGlobal getGlobal, check in the prontoscript guide.
|
|
Post 4 made on Thursday August 5, 2010 at 18:11 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,992 |
|
|
Note that System.setGlobal/getGlobal do not really create global variables as much as global storage by allowing you to store string values to be restored later. Rusty Fobe has posted some utilities in the files section that allow you save/reload array/object structures.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 5 made on Saturday August 7, 2010 at 17:47 |
alpha Long Time Member |
Joined: Posts: | September 2003 258 |
|
|
The omit the "var" worked great . I just added one line on the Activity Level to make things work with what I had .
I might try to add a "High Scores" Page to something I made in the past with the System.setGlobal/getGlobal .
Thanks for the help.
|
Project Boredom 2 is here. [Link: mediafire.com]------------------------ Check Version 1 & 2 out in the files section. |
|
Post 6 made on Saturday August 7, 2010 at 19:47 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,992 |
|
|
Omit the var or create a field in the activity scope which behaves like defining a var at the activity level:
CF.activity().dog = 20;
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 7 made on Sunday August 8, 2010 at 09:36 |
alpha Long Time Member |
Joined: Posts: | September 2003 258 |
|
|
I'll try it. Thanks.
|
Project Boredom 2 is here. [Link: mediafire.com]------------------------ Check Version 1 & 2 out in the files section. |
|
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our
Marketplace. For information on how to advertise your service or product
click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.