Flex 4 UIMovieClip 修改子 DisplayObject 的宽度

发布于 2024-11-07 02:30:42 字数 647 浏览 4 评论 0原文

我有一组 UIMovieClip 组件,它们驻留在 s:HGroup 标记中。在 ActionScript 代码中,我正在修改 UIMovieClip 之一中子剪辑的宽度,但 s:HGroup 不会反映这些更改。

<s:HGroup id="_buttonGroup">
    <uiassets:NavigationTabButtonSWC id="_lobby" />
    <uiassets:NavigationTabButtonSWC id="_achievements" />
</s:HGroup>
<fx:Script>
    <![CDATA[
        protected function init() : void
        {
            // The HGroup does not pickup this change and so my buttons
            // are no longer evenly spaced out and overlap!
            _lobby.getChildByName("background").width += 200;
        }
    ]]>
</fx:Script>

谢谢!

I have a collection of UIMovieClip components which reside in an s:HGroup tag. In ActionScript code I am modifying the width of a child clip in one of the UIMovieClips but these changes are not reflected by the s:HGroup.

<s:HGroup id="_buttonGroup">
    <uiassets:NavigationTabButtonSWC id="_lobby" />
    <uiassets:NavigationTabButtonSWC id="_achievements" />
</s:HGroup>
<fx:Script>
    <![CDATA[
        protected function init() : void
        {
            // The HGroup does not pickup this change and so my buttons
            // are no longer evenly spaced out and overlap!
            _lobby.getChildByName("background").width += 200;
        }
    ]]>
</fx:Script>

Thanks!

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

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

发布评论

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

评论(1

苏璃陌 2024-11-14 02:30:42

这有几个原因。仅更改一个子项的宽度并不意味着它会更改整个 UIMovieClip 的宽度,因此您应该首先检查这一点。

其次,Flex 有一种非常具体的处理方式(称为组件生命周期),UIMovieClip 没有实现这种方式,因此您无法在“测量”函数中自行管理宽度。我猜你的影片剪辑中有其他孩子,不允许你调整它的大小。尝试更改 MovieClip 本身的宽度,它应该可以工作。如果没有,那么还有另一个问题。

There's a few reasons for this. Just changing one child's width doesn't mean it'll change the whole UIMovieClip's width, so you should check that first.

Second, Flex has a very specific way of doing things (called the component lifecycle), which the UIMovieClip doesn't implement so you can't manage the width yourself in the 'measure' function. I'm guessing that you just have other children in your movieclip that doesn't let you resize it all. Try changing the width of the MovieClip itself and it should work. If it doesn't, then there's another problem.

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