开发者

how can I change the color of one shape by clicking on clicking another object of sprite in actionscript

开发者 https://www.devze.com 2023-03-31 20:40 出处:网络
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

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号