2 Replies Latest reply on Dec 13, 2007 10:38 AM by Big_Hugo

    Trying to have one movie clip code effect another movie clip

    Big_Hugo
      I am having trouble getting a simple function to work from outside of the movie clip that it is designed to effect. I want to be able to call the code from another movie clip as well as from a script in the main timeline.

      If I place this code on the movie clip itself, it works fine:

      on (rollOver) {
      var myColor:Color = new Color(this);
      myColor.setRGB(0xc2f79b);
      }
      on (rollOut) {
      myColor.setRGB(0xe0ffd4);
      }

      Here is the code I have tried on another movie clip, called target_mc:

      on (rollOver) {
      var myColor:Color = new Color(target_mc);
      myColor.setRGB(0xc2f79b);
      }
      on (rollOut) {
      myColor.setRGB(0xe0ffd4);
      }

      I get no error, but the color doesn’t change on target_mc.

      Here is the code I have tried in the main timeline:

      function color_chg() {
      var myColor:Color = new Color(target_mc);
      myColor.setRGB(0xc2f79b);
      }

      Then I simply call the function on the movie cip thus:

      on (rollOver) {
      color_chg();
      }

      Thanks for the help,
      Jon