RIACHINA 中国RIA开发者论坛RIA 客户端开发FLEX 专区 如何保证一个Array或者dataprovider里面的数据不重复

如何保证一个Array或者dataprovider里面的数据不重复

如何保证一个Array或者dataprovider里面的数据不重复

各位高手。我想用drag and drop实现一些简单功能。当我把东西拖过去的时候,我怎么知道目标容器(TileList)里面是否已经有了这个东西。我不想在目标容器中重复显示相同的item。 难道需要我每次拿过去后再从头检查么? 如何从dataprovider这里就避免数据重复。 我想知道一个比较完美的方法。谢谢了
最后编辑wabjtanm 最后编辑于 2007-07-11 22:45:43
 

回复:如何保证一个Array或者dataprovider里面的数据不重复

数据?没有重复?

如果单纯数据来讲的话
合理利用dataProvider
记得ARRAYCOLLECTION里面有一个contain(object)这样的方法。如果有的话,然后做什么什么
 

回复:如何保证一个Array或者dataprovider里面的数据不重复

Class ArrayUtil
-----------------------
createUniqueCopy    ()    method    
public static function createUniqueCopy(a:Array):Array

Create a new array that only contains unique instances of objects in the specified array. Basically, this can be used to remove duplication object instances from an array
Parameters
    a:Array — The array which contains the values that will be used to create the new array that contains no duplicate values.

Returns
    Array — A new array which only contains unique items from the specified arra
 

回复:如何保证一个Array或者dataprovider里面的数据不重复

Class ArrayUtil

this class in com.adobe.utils;
if u want to use it , u must be supported by corelib ActionScript 3 API Reference;


corelib
The corelib project consists of several basic utilities for MD5 hashing, JSON serialization, advanced string and date parsing, and more.

The corelib project is now hosted on Google Code at:

http://code.google.com/p/as3corelib/
 
1  /  1  页   1 跳转

版权所有 riachina.com   Sitemap

Powered by Discuz!NT 2.1.202    Copyright © 2001-2008 Comsenz Inc.
Processed in 0 second(s) (Cached).
返顶部