how can I change the color of one shape by clicking on clicking another object of sprite in actionscript
I have drawn intersecting lines. The user can click on a region i开发者_开发百科nside the angle formed by the two lines.When the user clicks inside the area, the small region formed by the arc between the two lines showing the angle should change. How can I do that.the region between the intersecting lines is sprite object to dispatch event listener, but the arc is shape object.
public class changeColor extends Sprite {
private var mySpr:Sprite;
public function changeColor() {
super();
mySpr = new Sprite();
mySpr.graphics.beginFill(0xFF0000, 1);
mySpr.graphics.drawRect(0, 0, 100, 100);
mySpr.graphics.endFill();
mySpr.addEventListener(MouseEvent.CLICK, action);
addChild(mySpr);
}
public function changeSprColor(inputColor:uint):void {
var myCt:ColorTransform = new ColorTransform();
myCt.color = inputColor;
mySpr.transform.colorTransform = myCt;
}
private function action(e:MouseEvent):void {
changeSprColor(0x00FF00);
}
}
精彩评论