4 Replies Latest reply on Aug 1, 2007 7:40 AM by webvalue

    How to get the Y value of a control?

    webvalue
      The Y value of a control returns always 0. Anyone saw it? A bug?
        • 1. Re: How to get the Y value of a control?
          kcell Level 2
          Do you have an example ? Some code ?


          • 2. Re: How to get the Y value of a control?
            webvalue Level 1
            SongTitle is a text field control.

            <mx:Text text="{SongTitle.x}" width="322"/>
            <mx:Text text="{SongTitle.y}" width="322"/>

            SongTitle.x will return a value but SongTitle.y is always 0, no matter where you place SongTitle. I also tried to change the layout fo the application file to be absolute, vertical, or horizontal. All the same: 0.
            • 3. Re: How to get the Y value of a control?
              kcell Level 2
              I have got a y value, it also change correctly when I change it .

              I tried it with the following code:

              <?xml version="1.0"?>
              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" >
              <mx:TextInput id="SongTitle"/>

              <mx:Text text="{SongTitle.x}" width="322"/>
              <mx:Text text="{SongTitle.y}" width="322"/>
              <mx:Button label="set Y" click="{SongTitle.y = newY.value}"/>
              <mx:NumericStepper id="newY" value="50" minimum="0" maximum="400"/>

              </mx:Application>

              I am using Flexbuilder 2.01.
              • 4. Re: How to get the Y value of a control?
                webvalue Level 1
                Your code works. But if I place the TextInput in the formItem and form tags, the Y value becomes 0. You can try this one:

                <?xml version="1.0"?>
                <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

                <mx:Form paddingBottom="0" paddingTop="0" paddingRight="0">
                <mx:FormItem label="Title:">
                <mx:TextInput width="275" id="newSongTitle"/>
                </mx:FormItem>
                <mx:FormItem>
                <mx:Button id="submitSongData" label="Add Song" width="150"/>
                </mx:FormItem>
                </mx:Form>

                <mx:Text text="{newSongTitle.x}" width="322"/>
                <mx:Text text="{newSongTitle.y}" width="322"/>

                <mx:Button label="set Y" click="{newSongTitle.y = newY.value}"/>
                <mx:NumericStepper id="newY" value="50" minimum="0" maximum="400"/>

                </mx:Application>