二つのforEachが終わった時にonloadを呼び出したいです。
何かいい方法はありませんか
画像読み込みの際表示の呼び出しが先に来て画像表示が出来なくなってしまいます。
JavaScript
1 2 let cardImage = function (list, onload) { 3 list.chara.forEach(data => { 4 const imgeName = data.imgname.match(/(.+)(.[^.]+$)/)[1] 5 Asset.register([{ 6 type: "image", 7 name: imgeName, 8 src: "cardimage/" + data.imgname 9 }]) 10 }) 11 list.magiaeria.forEach(data => { 12 const imgeName = data.imag.match(/(.+)(.[^.]+$)/)[1] 13 Asset.register([{ 14 type: "image", 15 name: imgeName, 16 src: "cardimage/" + data.imag 17 }]) 18 }) 19 20 }
回答1件
あなたの回答
tips
プレビュー