ScrollView_custom.js 959 B

1234567891011121314151617181920212223242526272829303132
  1. // Learn cc.Class:
  2. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. },
  14. // LIFE-CYCLE CALLBACKS:
  15. // onLoad () {},
  16. start() {
  17. this.scrollView = this.getComponent(cc.ScrollView);
  18. },
  19. onStopAndGotoTop() {
  20. this.scrollView.stopAutoScroll();
  21. this.scrollView.scrollToTop();
  22. }
  23. // update (dt) {},
  24. });