Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the replication methods of Flex ArrayCollection in Flex

Shulou Source: shulou.com Published: 2022-06-02 06:49:26 09月30日 Update

This article mainly introduces what are the replication methods of Flex ArrayCollection in Flex. It is very detailed and has a certain reference value. Friends who are interested must finish reading it.

Replication of Flex ArrayCollection in Flex

During the development of Flex, you often encounter the situation of copying Flex ArrayCollection. In the past, I just used to find a way to use it from the Internet, but I didn't specifically figure out why. When I have time today, I have studied it and summarized it as follows:

Replication in Flex, like java, is divided into deep replication and shallow replication.

◆ summarizes the shallow replication of Flex ArrayCollection. There are four methods:

1. VarnewArray:ListCollectionView=newListCollectionView (ListCollectionView (oldArray) .list)

2. VarnewArray:Flex ArrayCollection=newFlex ArrayCollection (oldArray.source)

3. VarnewArray:Flex ArrayCollection=newFlex ArrayCollection (oldArray.source.slice ())

4. VarnewArray:Flex ArrayCollection=newFlex ArrayCollection (oldArray.toArray ())

Among the above methods, * is not recommended because it is not a separate Flex ArrayCollection object created. The second, third and fourth methods are similar and can be used for reference.

Sometimes, we also use deep replication in ◆, as follows:

VarnewArray:Flex ArrayCollection=Flex ArrayCollection (this.clone (oldArray))

The this.clone () method is defined as follows:

Functionclone (source:Object): * {varmyBA:ByteArray=newByteArray (); myBA.writeObject (source); myBA.position=0; return (myBA.readObject ());} these are all the contents of the article "what are the ways to copy Flex ArrayCollection in Flex". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Method copy method content article reference similarity value interest object partner situation so time time more knowledge industry information information channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information Docker Apple MariaDB