Few days back one of the reader commented whether there is a way to change the “backgroundColor” of the ToolTips for different Controls dynamically in Flex. And my answer was “yes” and solution is here in this post.
What we got to do to achieve this ??
First we got to know about the Class StyleManager.
Basic information About the Class.
The StyleManager class lets you access class selectors and type selectors in ActionScript. It also lets you apply inheritable and noninheritable properties globally. Using the StyleManager, you can define new CSS style declarations and apply them to controls in your Flex applications.
[ These lines are from the HELP in Flex builder as they are the BEST, for any further information refer HELP from Flex Builder. 🙂 ]
Then Setting Styles with the StyleManager.
To set a value using the StyleManager, use the following syntax:
For Example here i want the backgroundColor of the ToolTip to change dynamically. So the line of code would be like below.
This can be called at any point where you would prefer to change , for example i can call this line on rollOver of a Button or a Control.[ Just keep in mind that this will reflect all the Visible controls in the App so care should be taken to reset the defaults when necessary ]
Now Enjoy this Demo here.
Comments are welcome. 🙂 , Enjoy the Post.