AS3 如何反转向量列表



我使用setTimeout进行服务器连接,当我连接时,我想反转我的矢量列表。如何反转我的矢量列表?

我的向量变量类

public class UriIterator 
{
private var _availableAddresses: Vector.<SocketConnection> = new Vector.<SocketConnection>();
private var currentIndex:int = 0;
public function UriIterator(){
}

public function withAddress(host: String, port: int): UriIterator {
const a: SocketConnection = new SocketConnection(host, port);
_availableAddresses.push(a);
return this;
}

public function get next():SocketConnection {
var address = _availableAddresses[currentIndex];
currentIndex++;
if (currentIndex > _availableAddresses.length - 1)
currentIndex = 0;
return address;
}


}

并像那样初始化我的矢量列表

public static const urisToTry: UriIterator = new UriIterator()
urisToTry.withAddress("https:// 123", 1234);
urisToTry.withAddress("https:// 123", 1234);
urisToTry.withAddress("https:// 123", 1234);
urisToTry.withAddress("https:// 123", 1234);

reverse(( 在向量上的工作方式与在数组上的工作方式相同。

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7fa4.html

最新更新