8 Replies Latest reply on Jun 22, 2006 8:16 AM by kglad

    Passing and Array Variable to a movie clip

    D._J._Faber
      I have an array with info in it on the main time line _root. When I try to acces the info within a movie clip timeline, the information becomes lost.

      In the attached code the printAnswers[arryCount] is what I want to access, but it becomes undefined.

      Thanks
        • 1. Re: Passing and Array Variable to a movie clip
          Level 7
          D. J.,

          > I have an array with info in it on the main time line _root.
          > When I try to acces the info within a movie clip timeline,
          > the information becomes lost.

          Honestly, it makes no difference what timeline you're looking from, as
          long as the array is in scope, or pathed to, you should be able to see it.

          > In the attached code the printAnswers[arryCount] is
          > what I want to access, but it becomes undefined.

          What steps have you taken to ascertain this value of undefined? Where
          is this array instantiated? Can you show that code, too?

          > for (var arryCount:Number = 0; arryCount<21; arryCount++) {

          Curious why 21. Why not printAnswers.length? Maybe you don't need all
          the array elements.

          > fillName = printAnswers[arryCount];

          Did you trace this? trace(printAnswers[arryCount]), trace(arryCount),
          trace(printAnswers), etc. Or were you looking in the Debugger panel?


          David
          stiller (at) quip (dot) net
          Dev essays: http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Passing and Array Variable to a movie clip
            kglad Adobe Community Professional & MVP
            is printAnswers an array of strings that match movieclip ids? if you think so, double check that there are movieclips linked for export that have linkages that match the strings in printAnswers. are clipHeight and whyValue defined before your loop? if yes, to both what's the problem?
            • 3. Re: Passing and Array Variable to a movie clip
              D._J._Faber Level 1
              The array variable is located on the _root directory. When I try to accces the variable array within a placed movieclip on the root directory, the information embeded within the array become undefined.
              • 4. Re: Passing and Array Variable to a movie clip
                Level 7
                D. J.,

                I can't tell if you're replying to kglad or me, but I'll take another
                swing at helping you out.

                > The array variable is located on the _root directory.
                > When I try to accces the variable array within a placed
                > movieclip on the root directory, the information
                > embeded within the array become undefined.

                My hunch is that nothing is *becoming* undefined. You're probably
                either failing to hit this variable or the array hasn't yet been populated.

                kglad raised some good questions. We're going to need more information
                from you. ;)


                David
                stiller (at) quip (dot) net
                Dev essays: http://www.quip.net/blog/
                "Luck is the residue of good design."


                • 5. Re: Passing and Array Variable to a movie clip
                  kglad Adobe Community Professional & MVP
                  what? what's an array variable? is that the name of your array, printAnswers? and what's a variable array?

                  and what do you mean by, " When I try to accces the variable array within a placed movieclip on the root directory"? do you mean you're trying to access printAnswers from a movieclip's timeline?
                  • 6. Re: Passing and Array Variable to a movie clip
                    D._J._Faber Level 1
                    OK, I guess I took the wrong direction with this. So I am changing my tactic, but I do need find out how to target a Dynamic Text Box (named with a variable) with in a movie clip (Linkage is set to Export). How does the syntax go? I have tried:

                    _root.movieClipName.variableName
                    _root.movieClipName.dynamicTextBoxName.variableName

                    Thanks
                    • 7. Re: Passing and Array Variable to a movie clip
                      Level 7
                      D. J.,

                      > OK, I guess I took the wrong direction with this.

                      Based on what? ;) I see two people, unclear on your terminology, who
                      are trying to help you out; that's all.

                      > So I am changing my tactic, but I do need find out
                      > how to target a Dynamic Text Box (named with a
                      > variable) with in a movie clip (Linkage is set to
                      > Export).

                      You can use eval() or the array access operator for that. See this
                      article for details.

                      http://www.quip.net/blog/2006/flash/actionscript-20/reference-objects-dynamically


                      David
                      stiller (at) quip (dot) net
                      Dev essays: http://www.quip.net/blog/
                      "Luck is the residue of good design."


                      • 8. Re: Passing and Array Variable to a movie clip
                        kglad Adobe Community Professional & MVP
                        the syntax to target an object (like a variable) depends upon the movieclip's instance name. you assign an instance name when you instantiate an object.

                        in your situation, (using a linkage id) you must be using attachMovie(). the 2nd parameter in your attachMovie() statement is your movieclip's name. the attachMovie() is the method of some movieclip (which in your first message would be _root).

                        so, you'd use: