Skip to main content
Known Participant
April 14, 2013
Answered

how to store an button color in var

  • April 14, 2013
  • 1 reply
  • 522 views

hi

i have 2 buttons

one red with instance name redc

the other is yellow with instance yellc

and one mc with instance rect_mc

i want when clicking redc button

the color of redc stored in a variable to use it on the mc

so when u click on the rect_mc the color of the mc changed to red

i tried that code but i guess there is no property called "Color"

var r:Color = new Color () ;

redc.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void

{

r = redc.color ;

}

This topic has been closed for replies.
Correct answer Ned Murphy

Look into using the ColorTransform class

var newColorTransform:ColorTransform = rect_mc.transform.colorTransform;

newColorTransform.color = ff0000;

rect_mc.transform.colorTransform = newColorTransform;

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 14, 2013

Look into using the ColorTransform class

var newColorTransform:ColorTransform = rect_mc.transform.colorTransform;

newColorTransform.color = ff0000;

rect_mc.transform.colorTransform = newColorTransform;

Known Participant
April 14, 2013

perfect thanks xD