I have the following code:
onEnter:function() {
var loadedScene = ccs.load(res.MAP_SCENE_json);
var scene = loadedScene.node;
this.addChild(scene);
var scrollView = scene.getChildByName("ScrollView");
this._super();
scrollView.setInertiaScrollEnabled(true);
scrollView.scrollToBottom(3.0, true);
}
The code works fine with web browsers, but is not scrolling using the Cocos runtime, why is this happening? I think the code is fine… The loadedScene is from a Cocos Studio .json.
Ok, I’m doing something wrong or it’s a bug. However there is a workaround, I’ve found that for runtime to work, you need to schedule an update, with scheduleOnce is ok. This way, the scrolling works both on runtime and web… weird.
onEnter:function() {
var loadedScene = ccs.load(res.MAP_SCENE_json);
var scene = loadedScene.node;
this.addChild(scene);
this._super();
scrollView.setInertiaScrollEnabled(true);
this.scheduleOnce(this.scrollIt);
},
scrollIt:function(dt){
var scene = this.getChildByName("Scene");
var scrollView = scene.getChildByName("ScrollView");
scrollView.scrollToBottom(5.0, true);
}