更改MovieClip的父级

发布于 2024-08-13 02:37:12 字数 175 浏览 1 评论 0原文

我想分离一个影片剪辑并将其附加到其他地方,但这在 AS2 中似乎不可能。

我正在寻找 Cocoa 的 addSubview/removeFromSuperview 的 AS2 等效项。

是否有替代路线可供选择,例如与新父母复制电影......这可能吗?

I want to detach a movieclip and attach it elsewhere, but it doesn't seem possible in AS2.

I'm looking for an AS2 equivalent of Cocoa's addSubview/removeFromSuperview.

Is there alternatives routes to go, such as duplicating a movie with a new parent.. is that possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请爱~陌生人 2024-08-20 02:37:12

据我所知,你不能这样做。

AS2有这个严重的缺点,如果你使用AS3,那就简单多了,因为图形不是那么直接绑定到对象,所以你可以删除一个子对象而不破坏它,然后将它重新附加到另一个displayObject。

但是,如果您坚持使用 as2...

我过去所做的是将有问题的 mc 缓存为位图,但只有当您需要的只是 mc 的“屏幕截图”时,这才有效。

处理这个问题的另一种方法不是在 FLA 中附加内容,而是创建一个类来保存您的“生命体”(如果您需要任何类似当前帧或 mc 位置的内容)。
然后将这些值从旧的 mc 转移到新生成的 mc,并销毁旧的。

As far as I remember, you cannot do this.

AS2 bears this serious shortcoming, and if you use AS3, it's a lot simpler, because the graphics are not so directly tied to the object, so you can remove a child without destroying it and then reattach it to another displayObject.

but, if you're stuck using as2...

What I've done in the past is cached the mc in question as a bitmap, but that only works if all you need is the "screenshot" of the mc.

Another way of dealing with this is not attaching stuff inside the FLA, but creating a class that can hold your "vitals" if you need any like current frame or position of mcs within.
then you transfer these values from an old mc to the newly generated one, and destroy the old one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文