Skip to main content
Participating Frequently
April 22, 2014
Question

Click object to change colour.

  • April 22, 2014
  • 1 reply
  • 222 views

Hi, I was just wondering does anyone know what code I would need to add to change the colour of myRedCircle when myBlueSquare is clicked?

The code I have already is below.

import flash.events.MouseEvent;

var myBlueSquare = new BlueSquare();

var myRedCircle = new RedCircle();

myBlueSquare.x= 50;

myBlueSquare.y=350;

myRedCircle.x=300;

myRedCircle.y=350;

myBlueSquare.addEventListener(MouseEvent.MOUSE_DOWN, doClick);

function doClick(e:MouseEvent):void

{

 

}

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 22, 2014

How is your RedCircle is designed?  Does it have different frames showing different colors, or do you intend to just transform its color from one to another using code?  If it's the latter, look into the ColorTransform class.  If it's the former, explain more about the RedCircle.

Participating Frequently
April 22, 2014

I just intend to transform it's colour from one to another. Ok I will, thank you!