Importing from Cocos Studio to Cocos2d-js

  • barabasandras1
    Likes 0

    Problem Description

    I followed the steps from here: http://cocos.sonarlearning.co.uk/v1.0/docs/importing-a-scene-into-cocos

    Still I get errors. JS: /data/data/org.cocos2dx.PrebuiltRuntimeJs/files/debugruntime/script/jsb_boot.js:768:TypeError: type is null

    This is what I do:
    1) I open Cocos Studio and create a new project.
    2) I use “Login Demo” because I just want to test this whole thing first.
    3) Once it is opened, I press CTRL + P (publish)
    4) In the publish settings, the Data Format is set to JSON File since I use Cocos2d-js.
    5) I copy the whole directory with its content that I just published (Default directory where all the checkbox images and fonts are, Login directory where the sprites are, and the json files that have been generated)
    6) So I copy these into my project folder->res directory where all the images and resources are located.
    6.5) I add the extra module “cocostudio” to the project.json file modules. 
    7) In Cocos Code IDE I use the following code:

    var rootNode = ccs.load("res/");
    this.addChild(rootNode.node);

    And I get the errors. What should ‘node’ be instead? What is going wrong? Either your tutorial isn’t really clear or I’m just too stupid for this stuff.


  • barabasandras1
    Likes 0

    I managed to solve this problem, but I still have a question. How do I reference to a node in the imported scene? For example I want to operate with a sprite on the scene, how do I reach it? rootNode.nameOfTheElement?


    This reply has been verified.
  • Sonar Systems admin
    Likes 1


    This reply has been verified.
  • barabasandras1
    Likes 1

    OK this one really helps, there’s the solution! Thanks for the info :D


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Great to hear :D


    This reply has been verified.

Login to reply