3 Replies Latest reply on Aug 31, 2008 4:20 PM by robdillon

    Movieclip color transform

      I am building a Smile Face application.
      Where you choose a menu item and an object or "movieclip" is placed on the stage. You can drag and drop the object, take it to the trash and change the color on any of the objects on the stage at any time.
      I have 2 problems that I am looking for guidance on.
      1. The code I use to change the color of the object is bulky.
      As it is, depending upon the amount of objects you have in the menu,
      the code could grow to a painful amount making it difficult to manage.
      I am looking for a way to better my existing code, by upgrading it to a more advanced method.
      I have attached my code here.
      If anyone could help steer me in the right direction, I would appreciate it.

        • 1. Re: Movieclip color transform
          robdillon Most Valuable Participant
          Try something like this. Use a set of arrays to keep track of the parts the colors and their values then you can do everything in one short function.
          • 2. Re: Movieclip color transform
            americancuervo Level 1
            Thanks for the answer Rob.
            It works perfect.

            I apologize for my last tread not making much sense.

            I have one question, that I would like to find the answer to.

            Is there anyway to create this function.
            for (j in partsList) {
            partsList[j].onPress = choosePart;
            Without it being an onPress, onRelease, onRollOver or onRollOut function?

            I ask, because I am incorporating
            the "GreenSock transform manager"
            which is already using the onPress and onRelease function for the partsList.
            ( http://blog.greensock.com/transformmanageras2/)

            Hope that makes sense,
            • 3. Re: Movieclip color transform
              robdillon Most Valuable Participant
              In my brief look at the transform manager it looks like you instantiate an object to hold an instance of this manager. Then you apply it through some event on a movieClip. In some of the greensock libraries, I use the TweenMax library and most of those methods allow you to call another function from within the tween method itself. And so you may be able to add a function like choosePart to the transform manager's methods. I didn't see anything that showed that was possible, but then I didn't see anything that showed that it wasn't. You will probably have to ask that question in the forum for the transform manager.