如何在flex 4中引用矩形/几何对象?

发布于 2024-12-04 13:56:02 字数 953 浏览 0 评论 0原文

我正在为一个项目进行几何对象转换。我需要在屏幕的 4 个部分上有相同的矩形。因此,当我更改一个矩形时,其他矩形也会发生变化,例如缩放或其他内容。

所以我可以用图像来做到这一点,只需给出“源”属性。如何处理几何对象?

    <s:Group id="rectangle" left="10" top="10">
        <s:Rect height="100" width="100">                              
            <s:stroke>
                <s:SolidColorStroke color="0x000000" weight="1"/>
            </s:stroke>
            <s:fill>
                <s:RadialGradient>
                    <s:GradientEntry color="0x11111" ratio="0" alpha=".5"/>
                </s:RadialGradient>
            </s:fill>
        </s:Rect>
    </s:Group>

<mx:Image scaleContent="true" left="400" top="5" 
                  source="{rect}"  autoLoad="true"/>

在这里,我在引用上面的矩形时遇到问题。

<mx:Image scaleContent="true" left="400" top="5" 
                  source="{rect}"  autoLoad="true"/>    

I'm doing an geometry object tranformations for a project. I need to have same rectangle across 4 parts in a screen. So when i change one rectangle others will be transformed like scaling or something.

So i was able to do this with image, just giving "source" attribute. How to do with geometry objects?

    <s:Group id="rectangle" left="10" top="10">
        <s:Rect height="100" width="100">                              
            <s:stroke>
                <s:SolidColorStroke color="0x000000" weight="1"/>
            </s:stroke>
            <s:fill>
                <s:RadialGradient>
                    <s:GradientEntry color="0x11111" ratio="0" alpha=".5"/>
                </s:RadialGradient>
            </s:fill>
        </s:Rect>
    </s:Group>

<mx:Image scaleContent="true" left="400" top="5" 
                  source="{rect}"  autoLoad="true"/>

Here i'm having a problem referencing above rectangle.

<mx:Image scaleContent="true" left="400" top="5" 
                  source="{rect}"  autoLoad="true"/>    

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

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

发布评论

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

评论(1

长发绾君心 2024-12-11 13:56:02

给矩形一个 ID:

    <s:Rect height="100" width="100" id="myRect" />                              

然后您应该能够通过 ActionScript 访问它。 矩形 具有属性scaleX 、scaleY 和scaleZ;但我不确定这是否是你想要的。您也可以仅更改高度和宽度来使物体更大/更小。

Give the rectangle an ID:

    <s:Rect height="100" width="100" id="myRect" />                              

Then you should be able to access it via ActionScript. The Rect has properties scaleX, scaleY, and scaleZ; but I'm not sure if that is what you want. You could also just change the height and width to make something bigger / smaller.

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