About the zOrder of CCSpriteBatchNode's children

Dear, Team-X
Currently, I get confused by the zOrder of of CCSpriteBatchNode’s children.
I am developing a game, which needs to bring the target sprite to the most front.

I tried to use setZOrder(int) method, but it seems not work every time.
I then went through the code, and found the following lines:

void CCSpriteBatchNode::reorderChild(CCNode **child, int zOrder)
{
CCAssert;
CCAssert, “Child doesn’t belong to Sprite”);
**if (zOrder == child->getZOrder())
{
return;
}*

//set the z-order and sort later
CCNode::reorderChild(child, zOrder);
}

Those code in the middle prevent my programme to executing “CCNode::reorderChild(child, zOrder)” all the time, since I have changed the value of ‘m_nZOrder’ of the child…
I cannot figure out the significance of those code, which do not exist in the method of ‘CCNode::reorderChild(CCNode *child, int zOrder)’.

Now I have to use ‘getParent()->reorderChild’ instead of ‘setZOrder’.

Could you tell me why CCSpriteBatchNode is designed to be like this, plz.
Thanks a lot. I am very grateful to your team and the your masterpiece, the cocos2d-x.

Sincerely,
Yang

I have stumbled upon this, too, and seek an explanation. Please assist, guys.

Thanks

I think I got the reason… Here it is from the docs:

sortAllChildren()
>
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
>
This appraoch can improves the performance massively.
>
Note
Don’t call this manually unless a child added needs to be removed in the same frame
>
Reimplemented from CCNode.

Thanks

This should be a bug. But seems no one have token notice on it.