Projects > cpp > Issues > Bug #3290

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

[JSB] onEnter order is wrong

Bug #3290 [Closed]
dumganhar 2013-11-27 08:06 . Updated about 10 years ago

This bug was reported by an email from a game developer.

The email contents are:

Recently, we’re developing a JSB game named 《一二三国》, we found a bug in Node.

Reproduce Step:

If there is a node tree like the following:


B and C are the children of A.

If A, B and C have implemented cc.Node.onEnter and they were added to scene graph,
In the implementation of cocos2d-x C++, the order of onEnter is: A~~>B~~>C which is also the same as cocos2d-html5.
But in JSB, the order is changed to B~~>C~~>A, this will cause compatibility issues between JSB and Html5.

The reason of this issue is:

arrayMakeObjectsPerformSelector(m_pChildren, onEnter, CCNode*);
m_bRunning = true;

if (m_eScriptType != kScriptTypeNone)
    CCScriptEngineManager::sharedManager()->getScriptEngine()->executeNodeEvent(this, kCCNodeOnEnter);

Since the executed order of ScripEngineManager::executeXXX is after arrayMakeObjectPerformSelector, It will cause the order of onEnter in JSB is B~~>C~~>A.


We should move ScripEngineManager::executeXXX at the beginning.

dumganhar 2013-11-27 08:06
  • Description updated (diff)
dumganhar 2013-11-27 08:07
  • Description updated (diff)
dumganhar 2013-12-30 05:38
  • Description updated (diff)
dumganhar 2013-12-30 08:25
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:79d95ab0e4889c2f5f2f69d87445efe17a39c165.

Atom PDF

Start date:2013-11-27
Due date:
% Done:


Target version:3.0-beta