5 Replies Latest reply on Aug 27, 2009 2:52 AM by Andrew Rosewarn

    Flex states x and y property

    Marlene Level 1

      I am working with Flex states and following directions from Training from the Source but I have also seen this happen before. When I am defining a state in design mode and switch back to source code i see the following

      <mx:SetProperty target="{bodyBox}" name="x" />

      <mx:SetProperty target="{bodyBox}" name="y" />

       

      Neither x or y has value properties. If I delete them, the application breaks but I do not understand what they are.

        • 1. Re: Flex states x and y property
          babo_ya Level 3

          /**

               *  The name of the property to change.

               *  You must set this property, either in

               *  the SetProperty constructor or by setting

               *  the property value directly.

               */

           

          So, in this case.. "x", and "y" coordinates?

           

          BaBo,

          • 2. Re: Flex states x and y property
            Marlene Level 1

            The x and y code are being added while I am in design mode. Why?

            • 3. Re: Flex states x and y property
              Andrew Rosewarn Level 3

              Are you changing the position of your bodyBox in design mode by dragging it around.  Have you done everything in design view or did your enter and mxml directly into code view?

              • 4. Re: Flex states x and y property
                Marlene Level 1

                I was working in design mode. Is that a problem?

                • 5. Re: Flex states x and y property
                  Andrew Rosewarn Level 3

                  Hi Marlene

                   

                  No it shouldn't be a problem. The syntax for the SetPropery tag usually looks like this.

                   

                  <mx:SetProperty target="{bodyBox}" name="x" value="200"/>
                  <mx:SetProperty target="{bodyBox}" name="y" value="200"/>

                   

                  The target is obviously the displayObject that you wish to change properties on, and the name="x", name="y" refer to the x and y coordinates of the object.

                   

                  Your code seems to be missing a value propery for each of the x and y coordinates which is the x and y you wish to set in this new state.  Without these values your object is going to default to x and y 0,0, or the coordinates of the first state defined in the mxml.

                   

                  Are  you working in the mail application container and does you bodyBox object goto 0,0 in this new state. Also is the layout of this container absolute or vertical / horizontal.

                   

                  To be honest I haven't seen the setProperty tag in this state before.  The only way I've come close to making this happen is to have the object constraint based in one state and then by removeing the constraints in the other,

                   

                  Maybe attach a file if you don;t mind?