4 Replies Latest reply on Dec 18, 2006 4:39 AM by Janine82

    objects String


      I have a problem using Strings and referncing to them within a function.

      I have a tick box that i have created on stage that on release makes an movieClip called mcTick visible or not visible.

      however i want to pass on that visible state to another box that has the same instance name as the 1st but with a "_1" on the end. To do this i made the instance name as a String and passed that into the function, and then referenced this using '_parent[boxName]._visible = ...' As soon as i changed the reference to a String it stops working. ANY help please. I am trying to learn to write AS using relative code and not absolute, also i want to insert this AS principle into a larger project that will have 20+ of these check boxes.

        • 1. Re: objects String
          cinemaguy Level 1
          You don't want to pass it as a string but rather as a movieclip tickBox(myName:MovieClip)

          and then call it by saying tickBox(this._name);
          • 2. objects String
            Marghoob Suleman Level 1
            i think following code will help you... you do it with one line code rather than wrting so much... ie...

            movieClip._visible = !movieClip._visible // This is toggle

            please see the below code... it should work... but i dont know why are you using string?

            • 3. Re: objects String
              Janine82 Level 1
              Thanks for the help cinemaguy and Marghoob Sulemaan!

              Marghoob i am using a string as i have 2 reports each with several tick boxes. 1 of these reports is being linked from the library into a scroll pane component and the other is to display the users ticks and no ticks for display only.
              I am using strings so that i can simpy reference the 2nd report's boxes by using the same function as i am for the 1st report just by adding '_1' onto the end of the instance name.
              • 4. Re: objects String
                Janine82 Level 1
                Marghoob Sulemaan thank you so much for this, i have never used eval before and im not 100% what it is, but i have printed off the help and so i will study!!

                thanks again, Seasons Greetings!!