开发者

How can i set hideEffect attribute to the GridRow using actionscript in flex?

i want to set fade 开发者_如何学编程effect to the GridRow when i remove it using removeChld() function

please tell me the solution ...


You can do this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Grid xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        <![CDATA[
            import flash.display.DisplayObject;

            import mx.containers.GridRow;
            import mx.effects.Effect;
            import mx.effects.Fade;
            import mx.events.EffectEvent;

            override public function removeChild(child:DisplayObject):DisplayObject {
                if(child is GridRow) {
                    var fade:Fade = new Fade;
                    fade.alphaFrom = 1;
                    fade.alphaTo = 0;
                    fade.addEventListener(EffectEvent.EFFECT_END, fadeEndHandler);
                    fade.play([child]);
                } else {
                    super.removeChild(child);
                }

                return child;
            }

            private function fadeEndHandler(e:EffectEvent):void {
                super.removeChild(GridRow(e.effectInstance.target));
            }

        ]]>
    </mx:Script>
</mx:Grid>

Make this a new MXML component, like FadingGrid, and use as normal. However, now removeChildAt is not overridden and thus using it won't produce the fade effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜