SOLVED:
The solution is instead of nulling out the borderSkin style, set it to a
Borderless skin, i.e.
package com.skins
{
import mx.core.UIComponent;
public class BorderlessSkin extends UIComponent
{
public function BorderlessSkin()
{
super();
}
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
super.updateDisplayList(unscaledWidth,unscaledHeight);
}
}
}
Hope that helps someone.
--- In [email protected], "fumeng5" <fume...@...> wrote:
>
> Hi,
>
> I have an HBox with a borderSkin property set to a Class I found that draws
> dashed borders.
> var imageContainer:HBox = new HBox();
> imageContainer.setStyle('borderSkin',com.skins.DashedBorder);
>
> When you click on/off the skin I want to toggle the borderSkin property, i.e.
> remove the dashed lines and make it look selected/unselected, i.e.
>
> if(container.name != _selectedImage.name){
> container.setStyle('borderStyle',null);
> container.setStyle('borderThickness',null);
> container.setStyle('borderSkin',null);
> }else{
> _selectedImage.setStyle('borderStyle','solid');
> _selectedImage.setStyle('borderThickness', '2');
> _selectedImage.setStyle('borderSkin', com.skins.DashedBorder);
> }
>
> That doesn't work. It draws the borderSkin just fine when I first instantiate
> the HBox, but when I start toggling it's gone.
>
> However, it works fine if I'm just using a borderColor and not a skin, a la:
>
> if(container.name != _selectedImage.name){
> container.setStyle('borderStyle',null);
> container.setStyle('borderThickness',null);
> container.setStyle('borderColor',null);
> }else{
> _selectedImage.setStyle('borderStyle','solid');
> _selectedImage.setStyle('borderThickness', '2');
> _selectedImage.setStyle('borderColor', 'green');
> }
>
> So....I guess you can't toggle borderSkin property...is that right?
>
> Thanks for any tips.
>