How to fix Flexlib WindowShade resize issues

I'm involved in a project that is using the flexlib WindowShade component and it generally works well unless its content is resized. Here's a simple fix for this.

Basically extend the WindowShade class list for the end of the resize event and set the height of the windows shade to NaN.

view plain print about
1package flexlib
2{
3    import flexlib.containers.WindowShade;
4    
5    import mx.effects.Resize;
6    import mx.events.EffectEvent;
7
8    public class WindowShadeFix extends flexlib.containers.WindowShade
9    {
10        public function WindowShadeFix()
11        {
12            super();
13            
14            addEventListener(EffectEvent.EFFECT_END, handleEffectEnd, false, 0, true);
15        }
16        
17        private function handleEffectEnd(event:EffectEvent):void {
18            // We set height = NaN so that the component resizes automatically to the height of its children.
19
            height = NaN;
20        }        
21
22    }
23}

Thanks goes to this bug and this blog article for showing it was an issue with the resize effect setting the height.

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)