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.
package flexlib
{
import flexlib.containers.WindowShade;
import mx.effects.Resize;
import mx.events.EffectEvent;
public class WindowShadeFix extends flexlib.containers.WindowShade
{
public function WindowShadeFix()
{
super();
addEventListener(EffectEvent.EFFECT_END, handleEffectEnd, false, 0, true);
}
private function handleEffectEnd(event:EffectEvent):void {
// We set height = NaN so that the component resizes automatically to the height of its children.
height = NaN;
}
}
}
{
import flexlib.containers.WindowShade;
import mx.effects.Resize;
import mx.events.EffectEvent;
public class WindowShadeFix extends flexlib.containers.WindowShade
{
public function WindowShadeFix()
{
super();
addEventListener(EffectEvent.EFFECT_END, handleEffectEnd, false, 0, true);
}
private function handleEffectEnd(event:EffectEvent):void {
// We set height = NaN so that the component resizes automatically to the height of its children.
height = NaN;
}
}
}
Thanks goes to this bug and this blog article for showing it was an issue with the resize effect setting the height.




There are no comments for this entry.
[Add Comment]