如何在flex 4中引用矩形/几何对象?
我正在为一个项目进行几何对象转换。我需要在屏幕的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
给矩形一个 ID:
然后您应该能够通过 ActionScript 访问它。 矩形 具有属性scaleX 、scaleY 和scaleZ;但我不确定这是否是你想要的。您也可以仅更改高度和宽度来使物体更大/更小。
Give the rectangle an ID:
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.