javascript - One line of code converting JSON file to JSONP with .js extension -


trying create html5 banner (in adobe flash cc 2015 canvas) , upload doubleclick studio. generates tiny json file doubleclick won't allow.

this 1 line entire json file. looks me it's guiding sprite placement images.

{"images": ["images/300x250_xf_1_atlas_.png"], "frames": [[220,0,159,270],[0,213,204,191],[206,272,196,191],[0,0,218,211]]} 

doubleclick studio won't accept json files (see below).

json: files ending .json not allowed. (json files not accepted studio cross-domain reasons. json files must rewritten static jsonp file .js extension). https://support.google.com/richmedia/answer/2672512<

here's function in html code loads json file.

function init() {     canvas = document.getelementbyid("canvas");     images = images||{};     ss = ss||{};      var loader = new createjs.loadqueue(false);     loader.addeventlistener("fileload", handlefileload);     loader.addeventlistener("complete", handlecomplete);     loader.loadfile({src:"images/300x250_xf_1_atlas_.json", type:"spritesheet",   id:"300x250_xf_1_atlas_"}, true);     loader.loadmanifest(lib.properties.manifest); } 

thank time spend helping me. i'm animator not forte. imagine every banner create have similar .json file output solution work of them if number of images changes.

maybe can try doing conversion manually text editor?

this json (is you've got)

filename: 300x250_xf_1_atlas_.json

{"images": ["images/300x250_xf_1_atlas_.png"], "frames": [[220,0,159,270],[0,213,204,191],[206,272,196,191],[0,0,218,211]]} 

this jsonp (just add callback(.....); json file)

filename: 300x250_xf_1_atlas_.js

callback({"images": ["images/300x250_xf_1_atlas_.png"], "frames": [[220,0,159,270],[0,213,204,191],[206,272,196,191],[0,0,218,211]]}); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -