LoginSignup
1
1

More than 5 years have passed since last update.

[tmlib.js] AssetManager で json 読み込み & type 指定

Last updated at Posted at 2013-10-21

[tmlib.js] AssetManager で json 読み込み & type 指定

YFukuyama san の 『tmlib.js AssetManager について』というエントリーを見て
『確かに!!』と思ったので対応してみました.

主に対応したのは下記の点です.

  • AssetManager.load で json 形式を読みこめるよう修正
  • AssetManager.load で type 指定を可能に

Example

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('読み込み終わったよ♪');
};
1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1