3 Replies Latest reply on Feb 14, 2011 11:06 AM by GordonSmith

    <fx:Declarations> binding problem

    m-b-r

      Hi.

       

       

      In Flex 4 I am getting an error "Data binding will not be able to detect assignments to "w_url", when I try to bind a variable in the declarations tag. I also tried with two-way binding @{w_url}, but doesn't work either.

       

      Here is the code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
         
          <fx:Script>
              <![CDATA[
                  import mx.controls.Alert;
                 
                  [BINDABLE] private var w_url:String="https://localhost/flex/login.xml";
                 
                  protected function MyLoginService_resultHandler(error:String):void
                  {
                      Alert.show(error);       
                  }
              ]]>
          </fx:Script>
         
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:HTTPService id="MyLoginService"
                             useProxy="false"
                             url="{w_url}"
                             result="MyLoginService_resultHandler(MyLoginService.lastResult.error_text)"
                             />
          </fx:Declarations>
      </s:Application>