4 Replies Latest reply on Mar 17, 2008 5:59 AM by hgingrich

    Help with button/action script

    hgingrich
      As part of a class I have to create an aquarium where I have pictures of fish on the side and I want to be able to click on the fish and have it add the fish to the aquarium. I want to be able to have the viewer select the number and types of fish they want in the aquarium. I'm using Flash 8 if that matters. Please, any help would be wonderful.
        • 1. Re: Help with button/action script
          rlc5611 Level 1
          So make your aquarium a movieclip and make each of your fish beside the aquarium a movieclip and give each fish an onRelease function. Make sure the fish have library linkages you can later use for attaching. onRelease of each fish should attach a copy of that fish from the library to the aquarium clip.

          Do the fish need to swim?
          • 2. Re: Help with button/action script
            hgingrich Level 1
            Yes the fish have to move around, but the tails do not have to move.
            • 3. Re: Help with button/action script
              rlc5611 Level 1
              In that case, make each edge of the aquarium (sides, top and bottom) movie clips too and have your fish move and reverse direction on hitTest with those clips. If the fish only have to swim left and right and not up and down, it is a little easier.

              I'll probably get in trouble for this but I didn't like the hitTest.

              This is AS2. You will have to make enough changes that, by the time you get finished with it, you will understand it.
              • 4. Re: Help with button/action script
                hgingrich Level 1
                Thank you for your help so far.

                I am just a beginner and that coding went way over my head. I have created a movie clip for each fish and I have added the buttons to the aquarium. I have created the linkage for the movie clips in my library. I am having problems attaching the clip to the button. In all of the examples I have seen I have to include the instance name. How do I give a clip that is not on the stage an instance name?

                Can you please help?
                Thank you
                hgingrich