0 Replies Latest reply on Oct 20, 2007 1:45 PM by SPGAnne

    trouble accessing instance names on stage

    SPGAnne Level 1
      I'm really baffled and have tried everything I can think of, but am at a loss. Help from you gurus would be sooooo much appreciated.
      Flash CS3, Actionscript 3, Flash Player 9. Note, all this code is in a bunch of classes, so sorry I can't put an easy snippet up here for you to look at.

      I have a movieclip (holderClip_mc) with a bunch of frames of text on one layer and some controls on another layer. Some controls are buttons (using the old SimpleButton stuff), some are movieclips. The controls are sometimes visible and sometimes not depending on the text layer's needs. I have key frames on the controls layer ,and when I don't want the controls to be there, I create a blank key frame. I have 2 problems.
      1) in my class code I refer to the controls using: var myNavClip_mc:MovieClip = holderClip_mc["navClip_mc"] syntax. This works fine, but when I do the same thing for the buttons var myNavButton_btn:SimpleButton = holderClip_mc["nav_btn"] I get errors. (note: nav_btn is the instance name I gave the button during author time). When I run the debugger I see that the instance name nav_btn shows up listed in the holderClip_mc instance, but the valule for nav_btn is null. I tried setting the linkage to export for Actionscript (using base class flash.display.SimpleButton), but that didn't seem to help.

      2) This is an even bigger head scratcher for me. When I navigate forward in the holderClip_mc frames, I am able to access the var myNavClip_mc:MovieClip = holderClip_mc["navClip_mc"] no problem, but when I go to a frame which doesn't have that instance on it anymore and then go back to the last frame that had it, it displays fine, but I can no longer access the instance. Again, when I run the debugger, I see going forward in the holderClip that the instance navClip_mc value show sthat it is a movie clip with all it's various properties, but when I go back, the debugger shows the value of the navClip_mc instance to be null. I tried making the last frame that it was visible on a key frame too so that when I come back to it I can access it, but again, no dice, debugger still shows it as null.

      Please help!!! I'm totally stuck.