I'm using actionscript. when you press the mouse, you can draw (using a rectangle) and when you click the mouse it changes colors. What I need to do is have buttons so that a user can click on the button to choose the color they want. How can I do this?

To allow users to choose a color using buttons in ActionScript, you can follow these steps:

1. Create a set of buttons for each color you want to offer. You can use the `Button` class or create custom buttons using the `MovieClip` class.

2. Assign a unique identifier or value to each button to represent the color it corresponds to. This value will be used later to determine which color is selected.

3. Add event listeners to each button that will capture when a button is clicked. For example, you can use the `MouseEvent.CLICK` event. When a button is clicked, it will trigger a function that handles the color selection.

4. In the color selection function, you can create a global variable to store the selected color value. When a button is clicked, you update this variable with the corresponding color value. For example, you can use a hexadecimal color code or an RGB value.

5. When the user clicks on the canvas to draw using the rectangle, you can retrieve the current selected color value from the global variable and apply it to the rectangle. This can be done using the `Graphics` class and its `beginFill()` method.

By following these steps, you can allow users to select a color by clicking on buttons, and then use that color for drawing when the mouse is pressed.