-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PageView addEventListener() doesn't work in Android #15325
Comments
@lifzgreat The latest v3 has already fixed this issue. |
Is it available on cocos2d-x.org? I had the latest as of not long ago! Or do I need to clone the repo? |
@lifzgreat no, it's not on cocos2d-x.org, you should clone the repo if you want to test it now. |
Ok, I will test it. I will respond with findings here. Thanks for the quick response! When does the main site get updated with the latest v3 branch? |
@lifzgreat It will happen in the early April, but I can't promise the exactly release date, lots tests need to be done before we officially announce the release to the public. |
Thanks so much! I am cloning now...wish me luck :) |
Ok, I just cloned the newest v3 branch and ran |
@lifzgreat Which project do you test? I have tested js-tests and it works fine. |
I ran it against my personal project. I will test js-tests on Android again to see if it works. Do I have to create the PageView in code or can I use Cocos Studio? |
@lifzgreat I think both ways should be working... either in code or with CocoStudio. |
Yes sir, it works perfectly in js-tests. I did notice a couple differences: var root = this._parseUIFile("ccs-res/cocosui/UIEditorTest/UIPageView/pageview_1.json");
var pageView =ccui.helper.seekWidgetByName(root, "PageView_1269"); I've always done: var root = ccs.load(res.Scene_json);
pageView = root.node.getChildByName("PageView"); Also, js-test has a pageview.json file that looks vastly different than the one that was exported from Cocos Studio for me. |
@lifzgreat Maybe you should pay attention to the page turn event callback. |
The callback is incredibly simple so this can't be it, right? ctor: function() {
pageView.addEventListener(this.pageScrolled, this);
},
pageScrolled: function(sender, type) {
cc.log("PageView scrolled.");
} I'm going to remove the /frameworks/runtime-src/proj.android folder and let it compile everything fresh. Maybe the new v3 I cloned isn't compiling certain pieces because they already existed from an old compile. |
@lifzgreat I don't quite understand how you are using the v3 branch code to do the test... |
Ok, I will do that if this doesn't work. Just for the sake of information, I moved my old cocos2d-x-3.10 folder to cocos2d-x-3.10_OLD and cloned the v3 branch into cocos2d-x-3.10. So it's using all of the new branch to compile. But I will do what you suggested if this next compile doesn't work :) |
As you suggested, I created a new project and imported my code into the newly created project and it worked perfectly. Thanks so much for the quick responses! I can't wait for the new cocos to come out to the public. What a fantastic framework. |
@lifzgreat 😄 Should I close this issue now? |
Yes sir! Thanks again :) |
This works in web but not in Android (posted here but realized that was deprecated). It's possible that it's not necessarily web vs Android but mouse vs touch.
The text was updated successfully, but these errors were encountered: