2 Replies Latest reply on Sep 19, 2006 2:27 PM by Matlus

    XMLList and length()

    Matlus Level 1
      As per documentation, the XMLList class has a length() method.
      When I use XPath (or whatever it's called in e4x) to retrieve a list of nodes that match the pattern the XMLList that is returned does not have a length() method. In fact I'm not sure if it has any properties and methods.

      In the debugger, I do see that the result is in fact an XMLList, but I don't see any properties. Calling any XMLList class methods throws an expection.

      Is this expected behavior?
        • 1. Re: XMLList and length()
          inlineblue Level 1
          It works fine for me. eg:

          var x: XML = <node name="bill"/>;
          var y: XMLList = x.(@name == "bill");
          trace(y.length()); //traces "1"

          Perhaps you should post a specific example of where it's failing.

          And the length() method would be the way to determine whether any matches were found (re: your other related question).
          • 2. Re: XMLList and length()
            Matlus Level 1

            That was my mistake. I used it like a property instead of a method.


            Can't stand this dynamic stuff in AS. Causes more harm than good IMO.