1
Technical forum / 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:
Nothing happens. So I tried attaching the following script to the button:
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?
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?