4 Replies Latest reply on Sep 22, 2008 3:00 PM by Gregory Lafrance

    Width property won't bind to a value

    istrasci Level 1
      OK, I have some (seemingly) simple data binding that's giving me warnings when I compile... I have a custom component and an HBox... I simply want the HBox's width to be whatever the width of the component is...

      <mx:HBox width="{comp.width}" ... > ... </mx:HBox>
      <my:component id="comp" .../>

      I do not declare a width for the component in the instantiation, nor in the declaration... Flex determines it by the width of all its sub-components... Anyway, when I compile, it's saying, "Data binding will not be able to detect assignments to 'width'." Am I missing something simple here...? Is it just because of the order I insert them (component after HBox)...? I don't think that should affect it... Someone help me out please!

      - Ian
        • 1. Re: Width property won't bind to a value
          Level 7

          "istrasci" <webforumsuser@macromedia.com> wrote in message
          news:gb8nf8$lr6$1@forums.macromedia.com...
          > OK, I have some (seemingly) simple data binding that's giving me warnings
          > when
          > I compile... I have a custom component and an HBox... I simply want the
          > HBox's width to be whatever the width of the component is...
          >
          > <mx:HBox width="{comp.width}" ... > ... </mx:HBox>
          > <my:component id="comp" .../>
          >
          > I do not declare a width for the component in the instantiation, nor in
          > the
          > declaration... Flex determines it by the width of all its
          > sub-components...
          > Anyway, when I compile, it's saying, "Data binding will not be able to
          > detect
          > assignments to 'width'." Am I missing something simple here...? Is it
          > just
          > because of the order I insert them (component after HBox)...? I don't
          > think
          > that should affect it... Someone help me out please!

          What is component extending?


          • 2. Re: Width property won't bind to a value
            istrasci Level 1
            quote:

            Originally posted by: Newsgroup User
            What is component extending?


            It extends HBox... Should that matter, though?
            • 3. Re: Width property won't bind to a value
              Level 7

              "istrasci" <webforumsuser@macromedia.com> wrote in message
              news:gb8s2d$rch$1@forums.macromedia.com...
              >
              quote:

              Originally posted by: Newsgroup User
              > What is component extending?

              >
              > It extends HBox... Should that matter, though?

              Just making sure it wasn't something weird where the width wouldn't be
              accessible. Maybe you'll have to go the roundabout route...setting a
              handler on creationComplete of comp and setting a variable based on that,
              which you'd then bind to from your HBox.

              Also look at constraints and percentages.

              HTH;

              Amy


              • 4. Re: Width property won't bind to a value
                Gregory Lafrance Level 6
                This works, so I don't know why you are having a problem: