AS3如何反转矢量列表

时间:2017-08-19 13:30:52

标签: arrays actionscript-3 vector

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

我的Vector变量类

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);

1 个答案:

答案 0 :(得分:1)