开发者

AS3 - addchild from stage to movieclip

I just tried to add the movieclip "box" to the "container.holder". Both movieclips are on stage. Nothing happends with this script.

container.holder.addChild(box); 

Wh开发者_运维技巧at do I miss there?


Edit

Maybe you forgot to stage.removeChild(box)?

Old

When you add box in holder you have to convert its "global" (stage) position to a "local" (holder) position using the globalToLocal method.

var global : Point = new Point(box.x, box.y);
var local : Point = container.holder.globalToLocal(global);
container.holder.addChild(box);
box.x = local.x;
box.y = local.y;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜