Hi there,
I am new to Cocos2d-js and I am trying to build an vertical scrollView with a starting position at the bottom of the view.
The scrollView itself is working fine. I just don’t get the starting position to the bottom.
I start like this:
var scrollView = new ccui.ScrollView(); scrollView.setDirection(ccui.ScrollView.DIR_VERTICAL); scrollView.setTouchEnabled(true); scrollView.setBounceEnabled(true); scrollView.setContentSize(320, 480); scrollView.setInnerContainerSize(cc.size(320, (level.length-1)*150));
level is just an array for creating the game field.
To this point everything is working out alright. But the view starts on the top of the game field.
I tried multiple things but they kinda didnt work out well:
scrollView.getInnerContainer().setPosition(0,0);
or
scrollView.jumpToBottom();
After that I add the childs to the corresponding layer:
this.addChild(backgroundLayer); this.addChild(scrollView); scrollView.addChild(lines); scrollView.addChild(pointsLayer);
What am I doing wrong? An interesting fact: If I get the position of the inner container with
scrollView.getInnerContainer().getPosition()
I get Object { x: 0, y: -270 } as a result.
If I set the position to { x: 0, y: 0 } in beforehand then the position is { x: 0, y: 0 } but the view wont move anyway.
Is there a update method or something like that I am missing?
I appreciate any help in this!