DX Script : How to access variable of another object

Hi all,

I'm going through some issue while building independent objects. And my biggest issue is to access variable (public or not) defined in the script of an object from an external object.

For example:
I'm building a simple scrollbar where I defined a variable called "progress".
My variable is updated whenever onMove happens, blablabla ... Anyway...

How do I access this "progress" variable from another object ? (ie: vitesse parameter)

How do I do that with group ?
My progress bar is a group of 2 objects. How can I access the variable defined in the group and not defined in any specific object in the group ? This group is consistent entity that is a unique interface for a better modularity.

I didnt check the concept of controller.
Can a controller help me ? if yes, how does it work ?

Thanks
Cyril
7,488 views 4 replies
Reply #1 Top
I don't think you'll need a controller. And trying to get a single variable that may or may not be defined in a member of a group sounds like it wouldn't work, but maybe I don't understand that part.

Anyway, if the variable is Dim-med outside of any subs in an object's script, then it can be accessed.

DesktopX.ScriptObject("TheObjectWhoseScriptDefinesTheVariable").variablename
Reply #2 Top
I thought you had to declare the variable with the Public keyword.
like this: Public myVar
and then you'd be able to access it like DesktopX.ScriptObject("someObject").myVar
Reply #3 Top
I believe it defaults to Public if it is defined outside of a Sub or Function.
Reply #4 Top
Ah. I think I've never tried it. Does the same happend in Visual Basic?