Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: AlphaColor problem  (Read 1562 times)

0 Members and 1 Guest are viewing this topic.

shuin

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • View Profile
AlphaColor problem
« on: June 11, 2014, 06:58:46 PM »

Hi guys. I want to make a main menu with 5 buttons. And I want to make the individual buttons semi-transparent (alpha value of 128 for example) when the mouse is over them.

So I tried to attach a simple script to one of the five buttons. This is the script:
Code: [Select]
on "MouseEntry"
{
this.AlphaColor = RGB(255, 255, 255, 90);
}
Also note that I've also tried using MakeRGBA(255, 255, 255, 128); instead of simply RGB, but it still didn't work.

Nothing happens. So I tried attaching the following script to the button:
Code: [Select]
on "MouseEntry"
{
this.Visible = false;
}
And it worked. If the mouse was over the button, it would toggle its visibility off. So the MouseEntry event is working. It's just the AlphaColor attribute that doesn't work for buttons.

Using the first code on the window's scripty worked with the desired effect: all the buttons were rendered semi-transparent. However, I want to make individual buttons semi-transparent, not all of them, so I need to use the code from a script attached to each button, not one attached to the window.
I even tried to do something different: from the button's attahced script, I set a variable to true on MouseEntry, and from the window's script on MouseEntry I check if the variable is true and then get control of the button and toggle its AlphaColor to half transparency. It still doesn't work.

So, anyone has any idea why the AlphaColor attribute doesn't work for buttons?
« Last Edit: June 11, 2014, 07:03:08 PM by shuin »
Logged
Untitled project status: production

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: AlphaColor problem
« Reply #1 on: June 13, 2014, 10:23:10 AM »

I've had a similar problem today with the sprite of a shadow.

I wanted it to be more blue and transparent so my code was:
Code: [Select]
shadow.AlphaColor = MakeRGBA(13, 5, 54, 100);
But nothing happened.
After checking the sprite in SpriteEdit, I saw the opacity was already set on 100.
So WME was reading only the setting from SpriteEdit: (255, 255, 255, 100).
After setting the opacity on 255 in SpriteEdit, the code in the script:

Code: [Select]
shadow.AlphaColor = MakeRGBA(13, 5, 54, 100);
started to work normally.

So if your buttons are sprites, check on SpriteEdit if, on every frame, alpha color is set on (255, 255, 255) and opacity on 255.
Then maybe your code in the script will work as expected.
Hope this helps!
Logged

shuin

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • View Profile
Re: AlphaColor problem
« Reply #2 on: June 13, 2014, 04:24:48 PM »

Thank you for the answer!

I will try it later today. I did manage to find a workaround, but this would be more elegant.
Logged
Untitled project status: production
 

Page created in 0.237 seconds with 23 queries.