load scene with a dynamic loading js file

load scene with a dynamic loading js file
0.0 0


My game has lots of scenes,to avoid a huge apk,I have to download these scenes(every scene is defined in a js file.) when game is running.

I need dynamic load the scene into the game while the downloading has been done.how could i do for that?

my scene coding(in a js file) like these:

`var Scene1Layer = cc.Layer.extend({
init:function () {
if (this._super()) {
winSize = cc.Director.getInstance().getWinSize();
var bgSprite = cc.Sprite.create(s_scene1_bg,cc.rect(0,0,winSize.width,winSize.height));
this.addChild(bgSprite, 0, 0);
return true;

Scene1Layer.create = function () {
var sg = new Scene1Layer();
if (sg && sg.init()) {
return sg;
return null;
Scene1Layer.scene = function () {
var scene = cc.Scene.create();
var layer = Scene1Layer.create();
return scene;


is there a reflect function like java( Class.forname(“Scene1Layer”))?

May be cc.BuilderReader.loadAsScene is a way:

var scene = cc.BuilderReader.loadAsScene("Scene1Lay.ccb");

but the cc.BuilderReader supports ccb file only….