javascript - Access cc.Director members and functions from utility file -


so i'm wanting create utility.js file contains actions , variables know i'm going need in several files. getting width , height of device.
try using:

var size = cc.director.getinstance().getwinsize();

but in standalone file, says director undefined. how can access director?

use cc.director instead of cc.director.getinstance()

cocos2dx-js v3.x api different v2.x

cc.director.getinstance() --> cc.director

here offical document


Comments