mercredi 24 juin 2015

Removing child from MovieClip's timeline

I'm loading swf file and creating MovieClip object from Linkage in swf Library. There are two frames in MovieClip timeline, separated, no tween. There is no code in frames or at objects. All the objects in frames are MovieClips and has one frame with graphic in it. There are 12 objects at first frame and 1 at second frame.

swf file first frame

I'm trying to remove one of the objects from first frame:

var mc:MovieClip = new clss() as MovieClip;
trace("total frames: "+mc.totalFrames);
mc.gotoAndStop(1);
trace("first frame numChildren: "+mc.numChildren);
mc.removeChildAt(0);
trace("first frame numChildren: "+mc.numChildren);
mc.gotoAndStop(2);
trace("second frame numChildren: "+mc.numChildren);
mc.gotoAndStop(1);
trace("first frame numChildren: "+mc.numChildren);

And I got:

total frames: 2
first frame numChildren: 12
first frame numChildren: 11
second frame numChildren: 1
first frame numChildren: 12

Why is there again 12 objects?

Aucun commentaire:

Enregistrer un commentaire