如何删除从一个基于对象的关联数组中的Flex 3的值?组中、对象、Flex

由网友(☀ 彼此安好互不扰 @)分享简介:我需要删除与在Flex 3关联数组属性关联的值;这可能吗?I need to remove the value associated with a property in a Flex 3 associative array; is this possible?例如,假设我创建了这个阵列像这样:For examp...

我需要删除与在Flex 3关联数组属性关联的值;这可能吗?

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?

推荐答案

删除不这样做,因为它在AS2做尽可能多的在AS3:

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

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

不过,我认为你的问题可能只需使用的toString(),即可以解决

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

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

delete myArray[someXML.@attribute.toString()];
阅读全文

相关推荐

最新文章