0 Replies Latest reply on Oct 10, 2006 8:38 AM by Winston2

    code re-use question

    Winston2 Level 1
      I'm a newb at actionscript but I am making progress so here's my question. I wanted to create a text button (no background rectangle-just text) that moved and changed color as the user rolls over and out of it. Therefore I created a dynamic text field, then encapsulated it in a mc then encapsulated the mc in another mc. The result is fine and it does what I want it to do. Here's the code on the root timeline that makes it work.

      b1.buttText.buttonText.text = "New Stuff";
      b1.buttText.onRollOver=over;
      b1.buttText.onRollOut=out;

      function over() {
      b1.gotoAndPlay(2);
      }

      function out() {
      b1.gotoAndPlay(7);
      }


      My question is "if I create another button, like b2, for example, how can I keep from having to copy all the function code above? I played around with 'this' a little but couldn't seem to get it to work. Many thanks.