How to get _root Array data from inside a deep MC hierarchy

I have some global Arrays defined and loaded with data at the _root level. Data is OK cause I checked it with the List Variables option.

I cannot address any of my arrays from within my MC hierarchy (not from MC2, MC1 or Component MC), BUT I can address variables defined at the root level correctly !!! Why??:

MC Hierarchy: ComponentMC–>MC1–>MC2–>Various MCs

I placed trace(_root.MyArray[0]); at MC2 level, then at MC1 level and finally at ComponentMC level but the sentence still reads “undefined”.

Is there a way to actually get my Arrays data from _root ?

Do while true
“Thanks”
Loop :slight_smile:

  Spongebob

If you defined global arrays then it should read _global.myArray[0] rather then _root, because arrays follow hierarchy. If its on the _root timeline make sure but if its global just use the _global property, thats probably whats causing you problems.

Hope this helps

Kyle:)

It’s not working yet :frowning:

I’ve defined this at _root level:

 [COLOR=orangered] _global.MyArray = new Array();[/COLOR] 

… and loaded it with data from a textfile.
If I check loaded data in the List Variables option it reads as follows:

Variable _global.MyArray = [object #33, class ‘Array’] [
0:“Argentina”,
1:“Uruguay”,
2:“Brasil”,
3:“Chile”,
4:“Paraguay”
]

My MC hierarchy is this (where Component MC is at _root level):
[COLOR=blue]ComponentMC–>MC1–>MC2–>Various MCs[/COLOR]

Then, I want to address MyArray from MC2 so I write in the first frame at MC2 level :

           [COLOR=green]trace(_global.myArray[0]);[/COLOR] 

According to MyArray data displayed before, _global.myArray[0] should display “Argentina”…

[COLOR=deeppink]BUT it still displays “undefined”.[/COLOR]

Am I doing something wrong ?

Thanks in advance,
Spongebob