- Creator 版本:2.2.2
Creator并没有提供打开摄像头的方法,如果要在h5游戏里打开摄像头,h5提供了input的方法。
js页面添加图片
var newImg = document.createElement(‘img’);
newImg.id = “imgSample”;
newImg.src = this.result;
$("#PhotoField").append(newImg);
但是h5的代码如何与creator结合?
Creator并没有提供打开摄像头的方法,如果要在h5游戏里打开摄像头,h5提供了input的方法。
js页面添加图片
var newImg = document.createElement(‘img’);
newImg.id = “imgSample”;
newImg.src = this.result;
$("#PhotoField").append(newImg);
但是h5的代码如何与creator结合?
原来 h5 上怎么写,现在也是一样的。
h5标签用不了,,我没注意到,直接上代码会被隐藏掉,类似这样
< input type=“file” id=“file” class=“filepath” onchange=“changepic()” accept=“image/*”>
let img = document.createElement(“img”);
然后添加各种属性