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