Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Global variable use

Avatar

Level 3

Dear All.

I set Global variable up in the Init as attached file.

variables.JPG

--------------------------------- Code ---------------------------------

var total = 0;

.

.

.

.

function Xxx(){

total = total + 10

app.alert(total);     // =====> 10

}

---------------------------------------------------------------------------

when i call Xxx(), Xxx() function alert 10;

in click event of button on the next page, i tried to call total variable(Global variable).

--------------------------------- Code ---------------------------------

app.alert(total);       // =====> error?

app.alert(Init.total);  // =====> 0

---------------------------------------------------------------------------

How can i use Global variable?

1 Accepted Solution

Avatar

Correct answer by
Level 10

To get the setting of the Init variable you woudl use Init.value

Paul

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

To get the setting of the Init variable you woudl use Init.value

Paul