From a05727411532fc9b27f6e87fa7e9d43936b9c3af Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 14 Nov 2013 14:08:50 +0800 Subject: [PATCH] set z order after reorder --- cocos/2d/CCNode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index e329f49c3e..c665b254b4 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -237,11 +237,13 @@ void Node::_setZOrder(int z) void Node::setZOrder(int z) { - _setZOrder(z); if (_parent) { _parent->reorderChild(this, z); } + // should set "_ZOrder" after reorderChild, because the implementation of reorderChild subclass of Node, such as Sprite, + // will return when _ZOrder value is not changed + _setZOrder(z); _eventDispatcher->setDirtyForNode(this); }