Search code examples
javascriptc++cocos2d-xcocos2d-jscocoscreator

How to call javascript function and pass value from c++ in Cocos2d-X/Cocos2d-JS with cocos creator


I want to call my javascript function from my Cocos2d-X cpp file and want to pass data from cpp class to javascript file. I tried and google it, but the solution i found was old and not found in current version of Cocos2dx/ Cocos creator. If anyone knows what the solution is, please help me, thanks very very much!

Already tried this how to call javascript function from c++ in cocos2d-x and https://discuss.cocos2d-x.org/t/how-to-call-js-functions-in-c-class/6243/3 But these solutions are old.


Solution

  • Got the solution. Below link solved my problem :- https://discuss.cocos2d-x.org/t/evalstring-function-is-missing-js-function-call-from-objective-c/47530