4 Replies Latest reply on Jul 22, 2010 11:01 PM by TejasJani123

    Binding problem in flex 4

    TejasJani123

      Hi,

       

      I am working on migrating our app from flex 3 to flex4. One of the things I am bumping into is that some one-way bindings that work in flex 3 don't seem to work in flex 4 any more.

       

      In the following sample (II have removed irrelevant code for clarity), the label (id="refreshLabel") has its enabled property bound to the visible property of addBox component.

       

      The function addChildToResults() sets the visible property of addBox child component to true, which should update the enabled property of the label to true, but this does not happen in flex 4. This works fine in flex 3 version of our app.

       

      This seems very trivial, so I was wondering if something has changed in flex 4 in this area, or if someone else has come across similar behaviour.

       

      thanks in advance.

      Tejas

       

      Here is a sample:

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Canvas

          xmlns:mx="http://www.adobe.com/2006/mxml"

          backgroundColor="0xffffff"

          creationComplete="creationComplete_handler(event)"

          horizontalScrollPolicy="off"

          verticalScrollPolicy="off"

          visible="false"

          minHeight="40"

          minWidth="180">

       

          <mx:Script>

              <![CDATA[

       

                  public function addChildToResults(oChild:DisplayObject):void

                  {

                      this.addBox.visible = true;

                      this.addBox.addChild(oChild);

                  }

       

       

              ]]>

          </mx:Script>

       

              <mx:Label

                  text=""

                  id="refreshLabel"

                  click="refresh_handler(event)"

                  mouseOver="refreshLabel.setStyle('textDecoration','underline')"

                  mouseOut="refreshLabel.setStyle('textDecoration','none')"

                  buttonMode="true"

                  useHandCursor="true"

                  styleName="searchControlsLink"

                  mouseChildren="false"

                  enabled="{addBox.visible}"/>

       

          <!-- Box to add children to -->

          <mx:VBox

              id="addBox"

              maxHeight="{this.maxHeight-30}"

              maxWidth="{Application.application.width - 200}"

              visible="false"

              />

       

      </mx:Canvas>