开发者

On Mouse Over change Sprite Graphics Color: AS3

I have created a sprite as below:

var arrowHeadRight:Sprite = new Sprite();
with(arrowHeadRight.graphics){
    beginFill(0xDDDDDD, 1);
    moveTo(50,0);
    lineTo(0,50);
    lineTo(50,100);
    lineTo(50,0);
    endFill();
}

On Mouse Over, I wish to change th开发者_如何学运维e color of the fill on this shape?

Can this be done or do I have to re-draw the graphics with an updated beginFill line?


I figured it out.

I can use the ColorTransform class:

var newCol:ColorTransform = new ColorTransform();
function nextOver(e:MouseEvent):void {
    newCol.color=0x666666;
    btnNext.transform.colorTransform = newCol;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜