This tutorial takes you step by step in creating a setcolor actionscript.
1. Open a new flash file.
2. Create a black ball with no outside stroke.
3. Use your arrow tool to click on the fill. Select Insert > Convert to symbol. Name it ball and set at movie clip.
4. Open the Instance Panel and name this instance of your ball, "myball".
5. Make an oval with black outline. Double click the oval to select it. Then
hold hold alt key and drag an new copy and place below the first oval. While
the second copy is still highlighted, holdy our alt key and drag a new copy
to just below the second so that there are three ovals.
6. Fill each oval with green, blue, and red respectively making note of
the hex code used for each one.
7. With the black arrow tool, highlight the green oval by double clicking.
Click Insert >
Convert to
Symbol. Name it greenbutton and set at "button".
8. Highlight the blue oval and convert to a button and name it bluebutton.
9.
Highlight the red oval and convert to a button and name it redbutton.
10. Click on the green button.
11. Open your actions panel. Click Actions
=>Variable => Set variable
12.
In the "variable" text box, type in "colorball".
13. Click in the "value" text box, then click the objects
=>movie =>color =>new Color.
14. Click inside the brackets for New Color() to set your curser
location. When your cursor is positioned, Click the Insert Target Path
(crosshairs)
at the bottom of the actions panel then on myball.
15. Then check the Expression box on the right
16. Make sure that second line of script that we just edited is still
highlighted. Then click object=> movie=> color=> methods=> set RGB.
Click in the object box in the parameters and type colorball. In the parentheses you will see 0xRRGGBB.
Highlight the RRGGBB part of this and insert the hex code for your green
color that you made note of before. On mine, I used 00FF00.
17. Click on the blue button and follow steps 12 thru 16, setting the hex
code
to the blue code that you used for the button. I used 0066FF.
18. Click on the red button and follow steps 12 thru 16, setting the hex
code
to the red code that you used for the button. I used FF0000.
19. Save your movie and test it to make sure it works.