Adding the Actionscript
Now it's time to add a little actionscript. Select the black button. Open the object actions window by pressing ctrl+alt+A. Press the + button and select setVariable from the dropdown menu (actions>setVariable). Insert the name of the color, in this case black , in the variable field. In the value field insert newColor(Background ) by selecting it from the dropdownmenu (objects>color>new color) and replacing the active selection(RRGGBB) with Backgound.
Now you have to select setRGB from the dropdownmenu (objects>color>setRGB). Insert the variablename you used in front of this method and the desired hexadecimal color after the 0x between the bracelets as shown in the example.
Repeat this with the other buttons. Make sure you don't use duplicate variable names, it will prevent the user to switch colors more then once !
|» Level Intermediate|
Rating: 6.88 Votes: 98
|You might have noticed, english is not my mother language. Therefore I hope that this tutorial will be understandable to you all. If you might have any questions on this subject, feel free to mail me !|
|Download the files used in this tutorial.|
|Download (21 kb)|
|More help? Search our boards for quick answers!|