1

Is it possible to use addChild with tweener or transitions, I mean not only bring the child to the stage, but at the same time make this animated?

especially in this type of code:

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);
user1212216
  • 41
  • 2
  • 9

3 Answers3

0

Yes. You would addChild first and then apply the tween to the child.

crooksy88
  • 3,849
  • 1
  • 24
  • 30
0

In you movieclip object add eventlistener in the constructor. I mean

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

and of course then you need to create your object as extended class

var background:Some = new Some()
//your stuff here
addChild(background);
zaynyatyi
  • 1,116
  • 6
  • 18
0

use tweenlite or something: http://www.greensock.com/tweenlite

Nicholas
  • 5,430
  • 3
  • 21
  • 21