Advice on variable scopes
Posted: Thu Oct 11, 2012 1:11 am
Hi, I'm seeking advice on a technique I'm using as an alternative with virtual custom properties to global variables and some problems I'm having with this approach. I got this idea from one of the lessons. I'm creating a sub-stack called 'globals' as part of my application. This 'globals' stack has scripting like:
local _variable
setProp uVariable pValue
put pValue into _variable
end uVariable
getProp uVariable
return _variable
end uVariable
My problem is that the local variables of this sub-stack don't seem to hold their values when I'm shifting between design and runtime, whereas other variables and fields seem to. My application consists of a main stack and a number of cards with my sub-stacks and those of 3rd party products as well.
Perhaps I'm going the wrong way of dealing with this. I'd appreciate any advice. Alex
local _variable
setProp uVariable pValue
put pValue into _variable
end uVariable
getProp uVariable
return _variable
end uVariable
My problem is that the local variables of this sub-stack don't seem to hold their values when I'm shifting between design and runtime, whereas other variables and fields seem to. My application consists of a main stack and a number of cards with my sub-stacks and those of 3rd party products as well.
Perhaps I'm going the wrong way of dealing with this. I'd appreciate any advice. Alex