Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 flex将带有动画的元素添加到虚拟组_Actionscript 3_Apache Flex_Flex4_Flex4.5_Flexbuilder - Fatal编程技术网

Actionscript 3 flex将带有动画的元素添加到虚拟组

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

目标是在我将新元素添加到动画中时添加一些平滑的动画(淡入淡出或移动) Vgroup容器

我试过:

<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!