4 Replies Latest reply on Jul 21, 2006 5:02 PM by kglad


    Thatnickname Level 1
      Hello all

      I'm trying to use a function that was written in an old .fla . In the old .fla, the function is called by a button click using _parent._parent._parent.duplicateMenuStyle() . So I copy/pasted the buttons in the new .fla and this call works fine in the new .fla if I use the buttons. But the problem is that in the new .fla, the function has to be called automatically when the movie loads and not after clicking buttons. My questions are how do I know what the _parent._parent._parent is and where do I put my code so it loads automatically when the swf is loaded?

      Thank You!
        • 1. Re: Functions()???
          derobinson Level 1
          The "_parent._parent._parent" is the scope of the funciton call...think of it kind of like a directory structure. The function was probably on the main timeline and the button calling it was embedded three steps down in various movie clips.

          If you've put the function on your main timeline, simply call the function somewhere bellow its definition in the code:

          function duplicateMenuStyle() {
          //funciton def here

          Good luck!
          • 2. Re: Functions()???
            kglad Adobe Community Professional & MVP
            the code that's attached to the button, attach to a frame that plays when you want that code to execute. if there's no code attached to the button, check the button's instance name and find the code that's in a buttonName.onPress or buttonName.onRelease handler.

            the movieclip referenced by those _parent prefixes is 3 generations older than the button (if that code is attached to a button) and 3 generations older than the timeline if the code is attached to a timeline). you can always use trace(this._parent._parent._parent) from that code's location to see what movieclip it's referencing.
            • 3. Re: Functions()???
              Thatnickname Level 1
              Yep got it, thanks guys!
              • 4. Re: Functions()???
                kglad Adobe Community Professional & MVP
                you're welcome.