Copy link to clipboard
Copied
Trying to change colour of an object using buttons.
this is my code
on (release) {
var object = new Color (_root.object) ;
object.setRGB(0x0066CC) ;
}
but then the error comes up and object doesnt change colour..!!!!
Copy link to clipboard
Copied
that's (incorrect) as2 code.
are you publishing for as3 or as2?
Copy link to clipboard
Copied
as3
Copy link to clipboard
Copied
delete the code you showed.
assign your button an instance name (eg, btn1) and attach to the first keyframe that contains btn1:
btn1.addEventListener(MouseEvent.CLICK,btn1F);
function btn1F(e:MouseEvent):void{
var ct:ColorTransform=btn1.transform.colorTransform;
ct.color=0x0066cc;
btn1.transform.colorTransform=ct;
}
Copy link to clipboard
Copied
ok so i changed my button to blue_btn because it is blue. i put the code in but the image i want doesnt change to blue.
Copy link to clipboard
Copied
The code has no errors which is good but the object i want to change colour isnt changing
Copy link to clipboard
Copied
copy and paste the code you used.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now