Question
AS 2.0 variable declaration queston: super basic but need help!
I've been teaching myself AS 2.0 and doing OK with it -- read
both Moock books (I'd love it if there were a comprehensive book
for AS 2.0 as there is for MX -- the "Essentials" book is great,
but not enough).
In any case, I don't fully understand how authored instances interact with AS 2.0.
If I put an instance on the stage manually, onto the main timeline, within the IDE, and then give it an instance name, e.g. "container_movie_mc", then I can simply refer to it from the first frame on the same timeline as "container_movie_mc" and get properties/methods of it? Can I call it this from any class called from the code on the main timeline? This doesn't always seem to work, e.g. I sometimes can't seem to do something as simple as container_move_mc.createNewEmptyClip() (or whatever the exact call is -- yes, I still rely on the popup code hints…). Do I need to reference it as _root.container_movie_mc ? Is it available like that from all classes?
Also, if I have an instance, container_movie_mc on my main timeline, and then declare
var container_movie_mc:MovieClip;
on the first frame of the main timeline, will this still reference the IDE instance? It seems to -- but I would think it would make a new variable, at least according to what I understand of scoping rules.
In short, I understand scope pretty well (except for callbacks), and referencing timeline variables using dot notation, but the basic nature of these undeclared (or implicity declared) variables floating around confuses me -- plus I don't understand why if I declare a variable with the same name it seems to remain the same variable as the one authored in the IDE, instead of overriding it? (Obviously the former behavior is preferable, I just don't understand it).
Please help ASAP if you can!
Thanks
Robert
In any case, I don't fully understand how authored instances interact with AS 2.0.
If I put an instance on the stage manually, onto the main timeline, within the IDE, and then give it an instance name, e.g. "container_movie_mc", then I can simply refer to it from the first frame on the same timeline as "container_movie_mc" and get properties/methods of it? Can I call it this from any class called from the code on the main timeline? This doesn't always seem to work, e.g. I sometimes can't seem to do something as simple as container_move_mc.createNewEmptyClip() (or whatever the exact call is -- yes, I still rely on the popup code hints…). Do I need to reference it as _root.container_movie_mc ? Is it available like that from all classes?
Also, if I have an instance, container_movie_mc on my main timeline, and then declare
var container_movie_mc:MovieClip;
on the first frame of the main timeline, will this still reference the IDE instance? It seems to -- but I would think it would make a new variable, at least according to what I understand of scoping rules.
In short, I understand scope pretty well (except for callbacks), and referencing timeline variables using dot notation, but the basic nature of these undeclared (or implicity declared) variables floating around confuses me -- plus I don't understand why if I declare a variable with the same name it seems to remain the same variable as the one authored in the IDE, instead of overriding it? (Obviously the former behavior is preferable, I just don't understand it).
Please help ASAP if you can!
Thanks
Robert