typescript 創建二維數組


private mouseView: Mouse
private mouseArray: Array<Array<any>> = new Array<Array<any>>();

public createMouse(){
        this.mouseView = new Mouse();
        // 定義二維數組
        for(var i = 0;i < 3;i++){
            this.mouseArray[i] = [];
        }
        this.mouseArray.push([]);
        
        
        for(var i = 0;i < 3;i++){
            for(var j = 0;j <= 3; j++)
            {
                this.mouseArray[i][j] = this.mouseView.createMouse(300*j,300*i);
                this.addChild(this.mouseArray[i][j]);
                this.mouseArray[i][j].touchEnabled = true; 
            }
        }
        
        this.mouseArray[0][0].addEventListener(egret.TouchEvent.TOUCH_BEGIN,function(){
            this.removeChild(this.mouseArray[0][0]);
        },this);
」

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM