How do I delete a value from an Object-based associative array in Flex 3?

10,195

delete doesn't do as much in AS3 as it did in AS2:

http://www.gskinner.com/blog/archives/2006/06/understanding_t.html

However, I think your problem might be solved by simply using toString(), i.e.

var myArray:Object = new Object();
myArray[[email protected]()] = "foo";

delete myArray[[email protected]()];
Share:
10,195
Chris R
Author by

Chris R

I'm a software developer and inveterate geek (like many here, I suspect). For work I use so many tools I usually can't remember them all, but recently they've been heavily Python/Java. C, Java/J2EE, various scripting and release engineering tools figure heavily in the list as well.

Updated on June 15, 2022

Comments

  • Chris R
    Chris R about 2 years

    I need to remove the value associated with a property in a Flex 3 associative array; is this possible?

    For example, suppose I created this array like so:

    var myArray:Object = new Object();
    myArray[someXML.@attribute] = "foo";
    

    Later, I need to do something like this:

    delete myArray[someXML.@attribute];
    

    However, I get this error message at runtime:

    Error #1119: Delete operator is not supported with operand of type XMLList.
    

    How do I perform this operation?