如何将x和y坐标从一个Flex组件复制到另一个Flex组件

时间:2010-03-17 05:40:16

标签: flex

我想根据另一个组件的x和y坐标,我尝试使用绑定表示法,但它似乎不起作用!

<?xml version="1.0" encoding="utf-8"?>
<s:VGroup   xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/halo"
            xmlns:vld ="com.lal.validators.*"
            xmlns:effect="com.lal.effects.*" 
            xmlns:components="com.lal.components.*"
            width="400" height="100%"
            right="0"
            horizontalAlign="right"
            verticalCenter="0">
......  

    <s:VGroup
        width="125"
        height="100%"
        horizontalAlign="right"
        gap="0"  width.normal="153" x.normal="247" width.expanded="199" x.expanded="201">

        ......

        <s:Panel includeIn="expanded" id="buttonsGroup"           
                 mouseOut="changeStateToNormal();"
                 mouseOver="stopChangeToNormal();"
                 skinClass="com.lal.skins.TitlelessPanel"
                 title="hi"
                 right="0"
                 width="125" height="700" >
            .....
            <s:Label text="Jump To Date" paddingTop="20" />
            <s:TextInput id="wholeDate" width="100"  
                         mouseOver="stopChangeToNormal();"
                         click="date1.visible = true"
                         focusOut="date1.visible = false"/>
            ...
        </s:Panel>
    </s:VGroup>
    <mx:DateChooser id="date1" 
                    change="useDate(event); this.visible = false; " 
                    visible="false"  
                    mouseOver="stopChangeToNormal();" 
                    y="{wholeDate.y}"
                    x="{wholeDate.x}" />    
</s:VGroup> 

1 个答案:

答案 0 :(得分:1)

我认为您的问题是由于您使用的容器类型造成的。当父容器使用绝对布局(例如Canvas)时,您只能为视图指定任意X和Y坐标。 VGroup有自己的想法,关于它将孩子放在哪里。如果要对子组件的位置进行任意控制,请使用绝对布局。