PDA

View Full Version : help changing the hex colour number of a movieclip on a button press



impsvi
November 19th, 2005, 08:06 AM
hi, im coding a api drawing program in flash8 and im trying to create a colour preview box.

i was attempting to write code to change the hexidecimal colour value of a movieclip (which is a white square with the instance name of colour_mc) when a button is pressed.

The code for the buttons which when pressed will change the colour of the white square look like this:

//colour is a varible for hexidecimal colour of the linestyle command
//colour_mc is the white square which is ment to change colour.

a_btn.onRealease = function() {
colour = 0x000000;
colour_mc.transform.colorTransform = 0x000000;
};


I thought this code would work but it doesnt the movieclip doesnt change colour at all. Does anyone know were im going wrong? thanks

scotty
November 19th, 2005, 08:25 AM
Use setRGB() :)

a_btn.onRelease = function() {
col = new Color(colour_mc);
col.setRGB(0x000000);
};

scotty(-:

Barn
November 19th, 2005, 02:21 PM
Except the color object need not be created on every button release event -- just create the color object once and then do the setRGB within the button event action.

impsvi
November 20th, 2005, 07:50 AM
thank you both! sorted.
I didnt realise i was the wrong command, im new to programming so i get confused.