2 Replies Latest reply on May 23, 2006 6:07 PM by ntsiii

    FB reports error: Function does not return a value

    ntsiii Level 3
      The following example does return a vlue, but FB does not understand.

      Can anyone verify? Is this a bug?

      Tracy
        • 1. Re: FB reports error: Function does not return a value
          Level 7
          Hi ntsiii,

          The problem is that if the "if" statement fails (because xmlnodeItem ==
          undefined), you don't specify a return value in that case. You probably
          want a 'return "";' below the end of the if block.

          > The following example does return a vlue, but FB does not understand.
          >
          > Can anyone verify? Is this a bug?
          >
          > Tracy
          >
          >
          > //labelFunction that defines how eac node should display in the tree.
          > private function nodeLabelFunc(xmlnodeItem:XMLNode):String
          > {
          > if (xmlnodeItem != undefined) {
          > var iNodeType:Number = xmlnodeItem.nodeType;
          > switch(iNodeType) {
          > case 1:
          > return "<" + xmlnodeItem.nodeName + ">";
          > break;
          > case 3:
          > return xmlnodeItem.toString();
          > break;
          > case default:
          > return "";
          > break;
          > }
          > }
          > }//nodeLabelFunc
          >


          --
          nj
          Flex Builder team
          • 2. Re: FB reports error: Function does not return a value
            ntsiii Level 3
            Ah, of course, thanks!
            Tracy