Thinking of a bug fix of Invalid Native object appearing in JSB

Source: Internet
Author: User

Cocos2d:jsb:error:file/users/dcx_jd/documents/cocos2d-x-2.2.2/scripting/javascript/bindings/generated/jsb_ cocos2dx_auto.cpp:line:4911, Function:js_cocos2dx_ccnode_removefromparentandcleanup

Cocos2d:invalid Native Object

Cocos2d:js:/var/mobile/applications/xxxxxx/documents/xxx/package/src/xxx/xxx/xxx/xxx:52:error:invalid Native Object

Above is the bug error message, appears invalid Native object This situation, the current encounter is caused by the display object, here is the process:

After you create an animated armature in a method, push to an array, then let the animation play the specified action, and then let Armature.removefromparent (TRUE) after the monitor hears the complete event of the animation.

Then in the final Destory, the Armature object is accessed by iterating through the array, at which point the armature.getparent () or armature.removefromparent (true) is reported invalid Native Obejct's error.

The solution is that after the animation complete, only removefromeparent is not possible, but also at this time to remove armature from the array, do not have any place on its reference, thus directly destroyed, destory in fact no longer deal with

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.