Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 8

Global Variable Not Available In Function

Why would be that a "m" variable would be available in one function and not another? I set a variable as global during a load sequence such as:

Later in code I have a large function that calls the and works perfect. I decide to cut the function up into smaller functions for debugging and modifications. I copied this section of the larger function and pasted into the smaller function. Nothing else changed, but when I call the smaller function I get error that variable is not Dim'd. Under the RunUserInterface I have declared the variable and populated it. Like I said, it is available in the original function. Just wondering if there is anything in general that may cause this.
0 Kudos
1 Reply
Level 8

Re: Global Variable Not Available In Function

If you call a function through an AA, "m" in that function refers to the AA, not to the global m. In such a function you can use GetGlobalAA to get the global m.

0 Kudos