Cocos2dx Reader Scene not responding to Touch

Cocos2dx Reader Scene not responding to Touch
0.0 0


Cocos2dx 3.16
Android Studio 3.0

Hello, I made a scene using the cocos2dx to creator c++ plugin and it loads fine on my LG G4 i can hear the music and buttons press in and out showing taps are felt. The issue is that my button will not do anything it reacts visibly but does not do the director end function i have tried various things and cannot figure out why my scene will not respond.

#include <reader/CreatorReader.h>
#include "MMScene.h"
#include "SimpleAudioEngine.h"
#include "ui/CocosGUI.h"
#include <ui/UILayout.h>

using namespace cocos2d;


Scene* MMScene::createScene()
    creator::CreatorReader* reader = creator::CreatorReader::createWithFilename("creator/MDiceX/MMScene.ccreator");

    // will create the needed spritesheets + design resolution

    // get the scene graph
    Scene * MMScene = reader->getSceneGraph();

    // ...and use it


// return the scene
    return MMScene;

// on "init" you need to initialize your instance
bool MMScene::init() {

    // 1. super init first
    if (!Scene::init()) {
        return false;

    auto FirstStartUp = ( ui::Layout * )this->getChildByName("FirstStartUp" );



    auto MMLeaderBoardButton = ( ui::Button * )this->getChildByName("MMLeaderBoardButton" );

    MMLeaderBoardButton->addTouchEventListener([&](Ref* sender, Widget::TouchEventType type){
        switch (type)
            case ui::Widget::TouchEventType::BEGAN:
            case ui::Widget::TouchEventType::ENDED:




    auto visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();



So your issue is that, MMLeaderBoardButton can not receive touch events, right? Could you please share me the creator project? I will take a look. Thanks.


@ManaInfested i have received your creator project, i will ask @drelaptop to take a look.


it’s my pleasure to take this, I will research it in detail.


@ManaInfested Sorry for a long response, I use the code and resource your supplied, then I found the bool MMScene::init() function never been called, so your addTouchEventListener didn’t work.

researching the code we can found the init function will be called only when the static __TYPE__* create() be called.

I fixed your issue and push the code into github, see this:

Cocos2d-x version: Github latest
Creator version: 1.8.1
build by CMake & Xcode 9.2


Thank you sooooo much!!! ^_^!!