addChild带有效果,例如Tweener OR过渡

时间:2012-02-24 16:43:37

标签: actionscript-3 transition addchild tweener

是否可以将addChild与tweener或者过渡一起使用,我的意思是不仅要让孩子上台,还要同时让这个动画化?

特别是在这种类型的代码中:

var background=new MovieClip  ;
var g:Graphics=background.graphics;
g.lineStyle(2, 0xFFFFFF);
var mat:Matrix;
var alphas:Array;
var ratios:Array;

mat=new Matrix();
alphas=[1,1,1];
ratios=[0,150,255];

mat.createGradientBox(30,19,toRad(-90));
g.beginGradientFill(GradientType.LINEAR,colors,alphas,ratios,mat);
g.drawRoundRect(2, 2, 30, 19, 5);
addChild(background);

3 个答案:

答案 0 :(得分:0)

是。您将首先添加theChild,然后将补间应用于子项。

答案 1 :(得分:0)

在构造函数中的影片剪辑对象addeventlistener中。我的意思是

package
{
import flash.display.MovieClip;
import flash.events.Event;

  public class Some extends MovieClip
  {
    public function Some()
    {
      addEventListener(Event.ADDED_TO_STAGE, Added);
    }
    public function Added(e.Event):void
    {
      removeEventListener(Event.ADDED_TO_STAGE, Added);
      addEventListener(Event.ENTER_FRAME, DrawLoop);
    }
    public function Added(e.Event):void
    {
      //here make your showing up effects
    }
  }
}

当然,您需要将对象创建为扩展类

var background:Some = new Some()
//your stuff here
addChild(background);

答案 2 :(得分:0)

使用tweenlite或其他内容:http://www.greensock.com/tweenlite