3 Replies Latest reply on May 6, 2008 1:00 PM by kglad

    Variable created in MC (AS2)

    tony_mead
      Hi there.

      I have a button on a movieclip that when clicked, will create a variable with a value. The problem is, I cannot seem to pass this variable and use on the _root. I have created the same but with the variable created on the _root and it works fine.

      I have tried using _root in various place on the code below but it returns 'undefined'.

      Any pointers on how I can access this variable on the root - see my code below

      Thanks a lot

      Tony Mead
        • 2. Variable created in MC (AS2)
          tony_mead Level 1
          Thanks kglad. Although this does work (and the next bit is an oversight by me). I am actually creating the variable to act as a dynamic name for a movieclip that I can work with after the onPress action. This requires the variable to not be enclosed in"" marks but when I remove the quotation marks I'm getting undefined.

          Again, I have the very same thing and it is working on a var that I'm creating that is already on the _root timeline.

          Any clues?

          Regards and thanks again,

          Tony
          • 3. Re: Variable created in MC (AS2)
            kglad Adobe Community Professional & MVP
            if panelActive is supposed to store a reference to a movieclip, you need to use the movieclip's instance name (or path/name if it's not on the timeline that contains that code). if you're getting undefined, it means you're not using the correct name (or path/name).

            you can always use trace(this) from the movieclip's timeline and from the timeline where you want to reference the movieclip to see the correct path/name.