Jump to content

Interactive color change


linem
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...