简体   繁体   中英

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 inside 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);
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM