Overview: I am having a confusing time figuring out what's
going on with the scope in a project I'm working on. I mocked up a
version of what I'm attempting, and have attached all the code (as
follows). I want to access/modify a var that resides on a
Problem: A movieclip (called
test) resides in the first frame of the main timeline.
test on it's first frame it declares a var called
testing. From the main timeline I ask what the value of
testing is, and it returns
Attempted Resolution: I have programmed in Java, and it has
what they call
mutator methods. I tried creating accessor/mutator functions
in the movieclip, but this didn't change the error message. I also
thought that it might be an issue with the ver of AS that I am
using. I have MX 2004 (v7.0) and I checked
livedocs to look into seeing if I was on track. As far as I can
tell I am.
you are encountering a timing issue. the code on the first
frame of your main timeline executes before the code in the first
frame of movieclips that are attached to that main timeline first
so, if you want to access variables on the first frame of
movieclip you must wait until those variables are defined either by
waiting until some timeline advances or initiating a loop that
checks if the variables are defined.