1. You really should cast e.result to something (I assume this must be an event you're getting from the WebService or similar class). But if not, then it looks even more weird:
- if DocumentElement is a property (not a name of XML node), then it should start with the lowercase.
- cast types whenever you use untyped access, i.e. if this[strTest] is meant to point to the object of type List, then do:
ActionScript Code:
((this[strTest] as List).dataProvider[keyIndexPos / 2] as XML).key.toString();
This works faster, makes your code at least somewhat readable, and let's you enjoy autocompletion.
Another thing to consider:
the scope inside the filter operator defaults to the currently processed node. So, if you use untyped access there, the compiler cannot forecast what variable are you going to refer inside the filter, so, if you do:
myXMLList.(this["someProperty"]);
the interpreter will look for "someProperty" node in the list's children, not in the function or class scope. And as even if you try to look for a child, which name's isn't in the XMLList you will get an XMLList as the result, the interpreter doesn't even try to look for your variable in another scope.
Bottom line:
- don't use untyped access.
- don't write "macaroni-style" code.
- cheers!