linem Posted July 30, 2018 Share Posted July 30, 2018 Hello, I am using this example to change the alpha of a graphics object at mousehover, but is it possible to change the color of the object as well? In the example code, when changing the value of the alpha property the drawn object is automatically updated at the mouse event, but I cannot make the same happen with color change. I can get the color to change by updating the color property and running lineStyle and drawCircle again but then the alpha is not responsive anymore. // make circle non-transparent when mouse is over it circle.mouseover = function(mouseData) { this.lineStyle(5, 0xFF0000, 1); this.drawCircle(150, 150, 100); this.alpha = 1; } // make circle half-transparent when mouse leaves circle.mouseout = function(mouseData) { this.alpha = 0.5; } Thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 31, 2018 Share Posted July 31, 2018 this.tint = 0x00ff00 . Color of shapes inside is multiplied by that parameter, so its better to meka white circle and tint it. Also if you want 10000 circles or so (people like that) you should look into generateTexture and use sprite instead, with same approach: change tint. linem 1 Quote Link to comment Share on other sites More sharing options...
linem Posted July 31, 2018 Author Share Posted July 31, 2018 Works perfectly. Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.