I developed a widget and would like users to be able to customize the colors. For this reason, I have provided a JS external interface to access color properties. Users can also pass in color properties as flash parameters.
When my widget is rendered, it will take a flash parameter for the background color. Setting the background color of my application container to the passed in color parameter screws up my widget layout for some reason. I have actually fixed this by making a call to validateNow() right after I set the new background color.
I thought this was the solution to my problem. Anytime someone used my external interface to change the background color of my widget, I could simply set the backgroundColor property to the new value, and then call validateNow() to force a redraw (I am not worried about this operation being heavy...does not matter in my situation). The strange thing is this does not work.
The first time I set a new background color and call validateNow() like so:
ActionScript Code:
if(applicationParameters.background_color != undefined){
background_color = applicationParameters.background_color;
}else{
background_color = 0xffffff; //default
}
this.validateNow();
the layout is fixed. But after that first time, if a user accesses my external interface:
ActionScript Code:
public function setBackgroundColor(rgb:String):void {
background_color = uint(rgb);
this.validateNow();
trace("changing back ground color to: " + background_color);
}
and submits a color change, validateNow() does not fix the issue
Can anyone even point me in the right direction on how to solve this issue? I am really stuck
Thank you!