2 Replies Latest reply on Sep 15, 2006 11:24 AM by TimSymons

    pass parameter

    jagguy99 Level 1
      how do you pass a parameter of a nested object
      I thought it was this but it doesn't work

      mc4.onPress = function() {
      var r1:MovieClip;
      var r2:TextField;
      r1=mc4;
      r2=txt4;

      move2(r1,r2);

      }

      function move2(mct:MovieClip, txt:TextField):Void
      {
      mct[txt].text="yy" //this fails

      }
        • 1. Re: pass parameter
          TimSymons Level 1
          It fails because you have a small scope issue.

          r2 = txt4;

          this should be:

          r2 = mc4.txt4;

          I say this because in your move2() function you try to reference the textfield inside the movieclip. If the textfield is not inside the movieclip then your assignment in the move2() funtion is incorrect.

          To make sure that you are getting the passed values use a trace() statement and see what you get.

          trace(mct);
          trace(txt);


          Tim
          • 2. Re: pass parameter
            TimSymons Level 1
            You know what, I just noticed that I have a scope issue too. :-)

            try this:

            r1 = this;
            r2 = this.txt4;

            I didn't notice that the "mc4" was the button too.

            Tim