7 Replies Latest reply on Jan 15, 2013 1:27 PM by Ned Murphy

    Object with multiple positions and colors- how to keep selected position even when changing color?

    zosaji

      I have a  makeover game where you can change the hands position of my model and also the skin color. In a movie clip with one skin color there are all the hands possible positions. But when you click to change the color the hands position jumps to the first keyframe, it doesn't stay to the position previously selected. How can I manage this, so that whatever the selected skin color, the hands position to be the one selected and the movieclip doesn't jump to the first keyframe with the first hands position? Or is there any other way to link the skin color and the multiple hands positions but in such manner that they aren't afected by each other?

        • 1. Re: Object with multiple positions and colors- how to keep selected position even when changing color?
          Ned Murphy Adobe Community Professional & MVP

          Can you explain how you have designed this functionality and show the code relevant to the problem.

          1 person found this helpful
          • 2. Re: Object with multiple positions and colors- how to keep selected position even when changing color?
            zosaji Level 1

            I have  a movie clip named doll,  in this movie clip I have on a frame     - the bodies that its a movie clip named doll,in this movie clip are all the colors of the bodies                                                                                                               

                                                                                                                     - on a second frame above the bodies is a movie clip named hands, in this movie clip are the colors of the hands with the initial position, each color its a movie clip named again hands, in witch I have the color ,example.... if I have the color black...the hands black are all in the same movie clip that its named hands, if I have the color white... the hands white are in the same movie clip that    its named again hands.  the hands are in the same frame line,but on different frames(1,2,3...), thats the same with the body. 

            the buttons for the body skin to change an preserve also the color of the hands have this code:  on (release)

                                                                                                                                                       {      _root.doll.doll.gotoAndStop(1);    

                                                                                                                                                              _root.doll.hands.gotoAndStop(1);  } 

            It's gotoAndStop..1,2,3...depends on the color you choose. for the hands I have the buttons that changes the position and the skin colors of the hands: 

                                                                                                                                                   on (release) {     

                                                                                                                                                  _root.doll.hands.hands.gotoAndStop(1);

                                                                                                                                                  }

             

            The problem is that I managed to change the skin and hands color to be the same...but when I change the position of the hand,and after maybe I want another color, the color is changing but like i said the position of the hands turns to the first position.

            Thank you for your help, and hope you have understand what I have said cause I'm not very good at explanation.

            • 3. Re: Object with multiple positions and colors- how to keep selected position even when changing color?
              Ned Murphy Adobe Community Professional & MVP

              I think I might understand what you have done and what the problem is.  WHenever you change the hands movieclip to be another color, you need to change the hands.hands movieclip to be at the same frame as it was for the other color.  So you need to keep track of which hands.hands position frame you are in and assign that anythime you change the color...

               

                   _root.doll.hands.gotoAndStop(1); // 2,3,etc

                   _root.doll.hands.hands.gotoAndStop(positionFrame);

               

               

              Other approaches for this.

               

              If you are using flat colors for the hands, one way would be to just use code to recolor the hands instead of using movieclips/frames  That way you don't have to change the hands movieclip for the different colors, which means you only need one movieclip for the positions... you essentially just recolor the hands in that one positions mc.

               

              Another approach would be to have all of your hand color mc's in the same frame and control their visibility.  Anytime you change the position of a hand, you change them all.  When you change the color, you first make all of the color mc's invisible, followed immediately by making the selected color mc visible.

              • 4. Re: Object with multiple positions and colors- how to keep selected position even when changing color?
                zosaji Level 1

                Hello, I have tried with the first thing you said to me, but it just goes to the next color and the position dosen't change anymore (maybe I did something wrong).   I'm not using flat colors so I can't use the recolor code.   I will try with the last one but let me see if I  understand:- I put all the hand colors mc's on the same frame. In each color mc's I have the positions... and then I put on the  timeline the code for visibility?  Thank you for your help

                • 5. Re: Object with multiple positions and colors- how to keep selected position even when changing color?
                  Ned Murphy Adobe Community Professional & MVP

                  For the last approach, you place all of the hands.hands into the same frame and give each one a unique instance name.  THen all you need to do is control the _visible property of each. 

                   

                  For situations like this it usually helps to have one function that turns all of the objects invisible.   By having that, when you go to change the color you first call that function to make every one invisible and follow it immediately with a command to make the selected one visible.

                  1 person found this helpful