flashactionscript-3xmllist

Deleting XMLList data, after certain element


Basically, since XMLList are similar to Arrays in many ways, I was wondering if I could do something like:

XMLList.length = 10;

I know this is not possible because 'length' in XMLList is not a property but is a method. Hence is something like a get method without a set method. Only XMLList.length() would work.

But is there a workaround. An easier one.

I know this can be done with loops or by converting the XMLList to Array, cutting off and converting it back to XMLList. I'd like to know if there's an easier way.


Solution

  • while (xmlList.length() > 10)
    {
        delete(xmlList[10]);
    }