0

希望有人可以提供帮助。我有一个 Flex (4.5/Air) 应用程序,它的图形声明如下:

<s:Graphic id="viewRect" width="200" height="200">
   <s:Rect id="border" width="200" height="200"> 
    <s:stroke >
        <s:SolidColorStroke  weight="1"  color="#606060" />
    </s:stroke>
   </s:Rect>

   <s:Ellipse id="upperLeftHandle" height="8" width="8" left="-2" top="-2" >
   <s:fill>
     <s:SolidColor color="#FFFFFF"/>
       </s:fill>
    </s:Ellipse> 
</s:Graphic>

当我以编程方式调整 Graphic 的大小时,它还会缩放边框 (Rect) 和椭圆 (upperLeftHandle)。我需要调整图形对象的大小,但让 Rect 和 Ellipse(以及 Graphic 内的任何其他内容)保持相同的比例。

有人有想法么?

4

2 回答 2

0

你必须像这样使用 Eclipse

<s:Ellipse id="upperLeftHandle" height="8" width="8" x="-2" y="-2" >

希望它能解决你的问题

于 2011-06-06T10:00:52.400 回答
0

您需要使用图形标签是否有特定原因?使用 Group 标签将允许您获得所需的定位和调整大小的功能。只要你只是改变组的宽度和高度,你就可以了,不会有缩放问题。

<s:Group id="viewRect" width="200" height="200">
    <s:Rect id="border" left="0" right="0" top="0" bottom="0"> 
        <s:stroke >
            <s:SolidColorStroke weight="1" color="#606060" />
        </s:stroke>
    </s:Rect>

    <s:Ellipse id="upperLeftHandle" height="8" width="8" left="-2" top="-2" >
        <s:fill>
            <s:SolidColor color="#FFFFFF"/>
        </s:fill>
    </s:Ellipse> 
</s:Group>
于 2011-06-10T18:17:28.760 回答