2 Replies Latest reply on Jan 21, 2008 5:38 AM by soup_pot

    Disabling button based on e4x xml node value

    soup_pot
      I thought this was going to be really simple but I guess it's not. I want to disable/enable a button based on the value of an e4x xml node.

      Upon creationComplete my application reads in some XML via HTTPService. At the same time it also calls a 'checkDraftStatus' function that is supposed to check the value of an xml node and then disable/enable a button accordingly. Eg (stuff stripped out for completion)

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      creationComplete="article_text.send(); checkDraftStatus(event);">

      <mx:HTTPService id="article_text" url=" http://...." resultFormat="e4x" />

      <mx:Script>
      <![CDATA[

      private function checkDraftStatus (event:Event): void {
      if (article_text.lastResult.content == "draft")
      {
      button2.enabled = false;
      }
      else
      {
      button2.enabled = true;
      }

      }
      ]]>
      </mx:Script>

      <mx:Button label="Save as Draft" id="button2" />

      What am I doing wrong? (I'm able to read the XML data fine otherwise)