[已解决]Cocos2dJS RC3 EditBox 和 cc.loader.load

Hi All

1,更新至cocos2dx js rc3 出现个问题 关于 cc.loader.load

        cc.loader.load(report,function(results){
            cc.log("INFO::播放战报:"+report); // results is null
            var msg = JSON.stringify(results);
            //cc.log("INFO:REPORT IS:" + msg);
        });

```


回调到方法里 results是空的 之前我提过这个bug 在rc2修复过 见 

https://github.com/pandamicro/cocos2d-js/commit/984c9b48385a65ff58f6eafb4e6735b9a505f4d8

是否跟异步加载回调状态有关?

有人能帮我们?


2,关于EditBox 我也提过这个bug 但是没回应

     这个问题大概是 如果我做了一个登录界面 使用EditBox 然后加入弹出框功能 弹出框出来后 EditBox会穿透弹出框 出现在弹出框上

     在native上没有问题 只是存在于web上 见

     
![](http://discuss.cocos2d-x.org/uploads/default/7202/627940a3933c8d58.png)


    
     代码见下
var EditTestLayer = cc.Layer.extend({
    _userName:null,
    init:function(){
        var bRet = false;
        if(this._super()){
            this._userName = new cc.EditBox(cc.size(459, 54), new cc.Scale9Sprite("res/start_account.png"));
            this._userName.x = cc.winSize.width/2;
            this._userName.y = 250;
            this._userName.setFontSize(12);
            this._userName.setPlaceHolder("Enter UserName");
            this._userName.setDelegate(this);
            this._userName.setMaxLength(20);
            this.addChild(this._userName);

            bRet = true;
        }
        return bRet;
    }
});

var ColorLayer = cc.Layer.extend({
    init:function(){
        var bRet = false;
        if(this._super(cc.color(0, 0, 255, 255), cc.winSize.width, cc.winSize.height)){
            var sprite = cc.Sprite.create("res/HelloWorld.png");
            sprite.attr({x:cc.winSize.width/2,y:cc.winSize.height/2});
            this.addChild(sprite);
            bRet = true;
        }
        return bRet;
    }
});
ColorLayer.create = function(){
    var colorLayer = new ColorLayer();
    if(colorLayer && colorLayer.init()){
        return colorLayer;
    }
    return null;
};

EditTestLayer.create = function(){
    var etl = new EditTestLayer();
    if(etl && etl.init()){
        return etl;
    }
    return null;
};

EditTestLayer.scene = function(){
    var sc = cc.Scene.create();
    sc.addChild(EditTestLayer.create());

    sc.addChild(ColorLayer.create());
    return sc;
};


```


有人能帮助我们?

第一个load的问题

回调方法参数变化了 changelog没有~~

调用方式

cc.loader.load(report,function(err, results){//第一个参数是错误代码  第二个参数才是results
            cc.log("INFO::播放战报:"+report);
            var msg = JSON.stringify(results);
 });

```

这个改变 其实会导致RC2 到 RC3修改的地方太多

毕竟改了load这种基础api

我觉得根据args.length 进行回调比较好 兼容性高点

否则升级成本太高

谢谢你的建议。 因为原来没有考虑到返回error, 所以加了一个。

以后会吸取该教训,在兼容性方面考虑更多一些。

再次感谢
David

而editBox的问题就真的不好解决, 因为Canvas不能接收输入,所以EditBox是用DOM元素来实现的,因此,只要显示出来,其一定是位于Canvas之上的。 而让引擎自动判断editBox是否被遮挡,这个计算成本又太高, 加上使用该控件的时候也不是太多,我建议在切换的时候,由用户加入兼容代码,当输入层不再是最上层时,就让editbox隐藏起来。

谢谢你 @ludingping 你解决了我的问题 谢谢

:7: 学习啦, 楼主好厉害。。