you should call cc.director.getRunningScene()._sgNode.visit(), Cocos Creator actually have two separate tree:
logic tree: it’s the entity tree. Creator is component based architecture, each entity has a related sgNode and each rendering component also has a sgNode. The sgNode is explained in the following section.
render tree: the render tree is the original cocos2d-html5 node tree, each node is also know as a sgNode .