不缩放子 movieClip?

发布于 2024-07-25 18:49:05 字数 206 浏览 7 评论 0原文

我有一个如何转换父动画片段而不是子动画片段的问题...我有一个动画片段,其中包含图像加载器和一些句柄作为动画片段。 动画片段句柄用于监听鼠标事件,以执行父动画片段的缩放、旋转和平移等功能。 这里的问题是,当我缩放或旋转影片剪辑时,手柄也会旋转和缩放,尽管我希望它在父影片剪辑旋转时跟随父影片剪辑,但我不希望手柄也缩放。

有没有办法避免手柄缩放。

谢谢

I have a question of how to transform the parent movieclip and not the child movieclip...I have a movieclip holding an image loader and some handles as a movieclip. The handles movieclips are used to listen the mouse event to do such function scaling rotation and translation of the parent movieclip. The problem here when I scale or rotate the movieclip the handles also rotate and scale although I want it to follow the parent movieclip while the parent movieclip is rotating but I don't want handles to scale as well.

Is there a way of avoiding the handles from scaling.

Thank you

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

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

发布评论

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

评论(5

那请放手 2024-08-01 18:49:05

尝试这个:

inside_mc.addEventListener(Event.ENTER_FRAME, function(){
    inside_mc.scaleX = 1/inside_mc.parent.scaleX;
    inside_mc.scaleY = 1/inside_mc.parent.scaleY;
});

Try this:

inside_mc.addEventListener(Event.ENTER_FRAME, function(){
    inside_mc.scaleX = 1/inside_mc.parent.scaleX;
    inside_mc.scaleY = 1/inside_mc.parent.scaleY;
});
尘世孤行 2024-08-01 18:49:05

如果你不坚持这个结构,我会重新安排事情。 例如,我会像这样构建它:

- container
    - handles
    - image loader

这样您只需担心将手柄放置在正确的位置,而不用处理缩放问题。

如果必须保持相同的结构,则需要将手柄比例设置为父级比例的倒数。 例如,如果父级的比例为 2,则您希望控制柄的比例为 0.5。 因此,要计算手柄的比例,您所需要做的就是将 1 除以父级比例。

If you're not stuck with that structure I would just rearrange things. For example, I would build it sort of like this:

- container
    - handles
    - image loader

This way you only have to worry about placing the handles in the correct places rather than dealing with scaling issues.

If you have to maintain the same structure, then you'll need to set the handles scale to be the inverse of the scale of the parent. For example, if the parent's scale was 2, you'd want the handle's scale to be 0.5. So all you have to do to calculate the handle's scale is to divide 1 by the parents scale.

五里雾 2024-08-01 18:49:05
  1. 覆盖父 MC 中的set heightset width函数(您也可以执行scaleXscaleY) 。
  2. 在重写的函数中,通过调用 super 设置值,然后检查scaleX/scaleY
  3. 设置 scaleX (宽度)scaleY(高度) 为 1./scaleX (宽度)1./scaleY (身高)

这很容易。

  1. Override the set height and set width functions in the parent MC (you could do scaleX and scaleY as well).
  2. In the overridden functions set the value, by calling super and then check the scaleX/scaleY
  3. set the scaleX (for width) or scaleY (for height) of the child MC to 1./scaleX (width) or 1./scaleY (height)

That was easy.

满地尘埃落定 2024-08-01 18:49:05

在 onEnterFrame 处理程序或类似的处理程序中,将scaleX和scaleY设置为1/(parent.scaleX)和1/(parent.scaleY)。

In an onEnterFrame handler or something like that set scaleX and scaleY to 1/(parent.scaleX) and 1/(parent.scaleY).

抱猫软卧 2024-08-01 18:49:05

您所描述的是更复杂的方法,并且它不会准确地调整大小/重新定位,并且会消耗更多的CPU。 最好的方法(顺便说一句,我在睡觉时想到的)是创建一个新的子项,将其命名为backgroundMC(名称应该很清楚)并调整backgroundMC的大小,而不是父项的大小。 父窗口会自动调整大小,但子窗口不会缩放

what you described is the more complicated way to do it, and it does not resize/reposition exactly, and is more CPU eating. the best way to do it (which btw came to me while I was sleeping) is to create a new child, call it backgroundMC (the name should make it clear) and resize backgroundMC, not the parent. the parent will automatically resize to the size of it, but the child windows wont get scaled

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