Actionscript 3 flex将带有动画的元素添加到虚拟组
目标是在我将新元素添加到动画中时添加一些平滑的动画(淡入淡出或移动) Vgroup容器 我试过:Actionscript 3 flex将带有动画的元素添加到虚拟组,actionscript-3,apache-flex,flex4,flex4.5,flexbuilder,Actionscript 3,Apache Flex,Flex4,Flex4.5,Flexbuilder,目标是在我将新元素添加到动画中时添加一些平滑的动画(淡入淡出或移动) Vgroup容器 我试过: <fx:Declarations> <s:Move id="addedEffect" duration="800" xTo="100" /> </fx:Declarations> <s:VGroup id="answersGroup" width="100%" height="100%" addedEffect="{addedEffect}" > p
<fx:Declarations>
<s:Move id="addedEffect" duration="800" xTo="100" />
</fx:Declarations>
<s:VGroup id="answersGroup" width="100%" height="100%" addedEffect="{addedEffect}" >
protected function button1_clickHandler(event:MouseEvent):void {
for (var i:int = 0;i<3;i++) {
var good:GoodAnswer = new GoodAnswer();
answersGroup.addElement(good);
}
}
受保护的函数按钮1\u clickHandler(事件:MouseEvent):void{
对于(var i:int=0;i您需要将addedEffect添加到GoodAnswer项,而不是VGroup
假设GoodAnswer扩展了一个具有“addedEffect”样式的类,例如从0淡入1,持续时间为2秒
<fx:Declarations>
<s:Fade id="fade" duration="2000" alphaFrom="0" alphaTo="1" />
</fx:Declarations>
<s:VGroup id="answersGroup" width="100%" height="100%">
protected function button1_clickHandler(event:MouseEvent):void {
for (var i:int = 0;i<3;i++) {
var good:GoodAnswer = new GoodAnswer();
good.setStyle("addedEffect", fade);
answersGroup.addElement(good);
}
}
受保护的函数按钮1\u clickHandler(事件:MouseEvent):void{
对于(var i:int=0;iWorks!但是持续时间应该是2000,而不是2!