Hi again, everyone. I have another issue with variable referencing I was hoping you could help with. I have an empty movie clip (MClevel) that gets an attached mc from my library (MCplayer). The attached clip has NON-global variables that I need to reference from MClevel, but I don't know the correct syntax to point to it. VB.NET allowed you to simply reference a remote variable through the "." structure (ie. MCplayer.myvar) from anywhere in the form. Needless to say Flash doesn't follow the exact same method. When I trace [i]MCplayer.myvar[/i] it always outputs "undefined." Any ideas? Thanks.
Hi, I put this code in frame 1: this.attachMovie("mcPlayer","mcPlayer",1); trace(this.mcPlayer.myVar); and as stated, it traces undefined... looking at my objects in the debugger shows that I have a movieClip there called _level0.mcPlayer with a variable of myVar... so that led me to think that at the time of the trace, that part of the code hasn't run to instantiate the variable in the attached movieClip ... deals with all the code in itself first then the other clips... this would mean it was undefined on frame1... so on frame 2 I put the trace again... stop(); trace(this.mcPlayer.myVar); this time the output returns : "_level0.mcPlayer is the location for this variable"; so, in summary, your annotation is correct, but the clip hasn't initialised at the point that you call the variable... hope that helps. cheers,
// Are you doing this? MClevel.attachMovie("playerSymbol", "MCplayer", 1); // If so, the player clip is placed inside your empty level clip so you need to say: trace( MClevel.MCplayer.myVar );
Don't see what you're looking for? Try a search.
|