[英]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 我想在使用removeChld()函数将其删除时为GridRow设置淡入淡出效果
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. 使它成为一个新的MXML组件,例如FadingGrid,并照常使用。 However, now removeChildAt is not overridden and thus using it won't produce the fade effect.
但是,现在removeChildAt不会被覆盖,因此使用它不会产生淡入淡出效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.