Skip to content

Instantly share code, notes, and snippets.

@phi-jp
Created October 21, 2013 06:12
Show Gist options
  • Save phi-jp/7079366 to your computer and use it in GitHub Desktop.
Save phi-jp/7079366 to your computer and use it in GitHub Desktop.
[tmlib.js] AssetManager で json 読み込み & type 指定 ref: http://qiita.com/phi/items/3c816dce3c1fad518d93
tm.asset.AssetManager.load({
// 普通に読み込む
"image_data": "./kenkyo.jpg",
// type を省略しているので tmss として読み込まれる
"tmss_data": "./crash.tmss",
// tmss だけど type で json を指定しているので json で読み尾込まれる
"json_data00": { url: "./crash.tmss", type: "json" },
// url にオブジェクトを渡しているけど type が json なので File としてかえってくる
"json_data01": { url: {hoge:100, foo:200}, type: "json" },
});
tm.asset.AssetManager.onload = function() {
console.log('読み込み終わったよ♪');
};
@oufuoufu
Copy link

oufuoufu commented Nov 3, 2013

ver 0.1.8 で
tm.asset.AssetManager.load({
"json_data01": { src: {hoge:100, foo:200}, type: "json" },
});
と書くと
Uncaught TypeError: Object # has no method 'split'
というエラーが出るんですが
どう対処すればいいでしょうか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment