@531223011 写道:
用的html5来获取的相册
1,然后发布到web上用手机浏览器访问可以打开相册
2,微信扫一扫也可以打开相册
3,但是发布apk后安装到手机上的app却打不开!!!为什么呀??为什么呀??function loadLocalimg(uri) { var my = document.getElementById("divCreator"); if(my===null) { my = document.createElement("div"); document.body.appendChild(my); my.style.position="absolute"; my.id="divCreator"; my.style.width=100; my.style.height=100; my.style.backgroundColor="#ffffcc"; } my.innerHTML = '<img id=imghead>'; var img = document.getElementById('imghead'); img.onload = function() { var n=0; var spriteFrame=spImg.getComponent('cc.Sprite').spriteFrame; var texture=spriteFrame.getTexture(); texture.initWithElement(this); texture.handleLoadedTexture(); cc.log("width="+this.width); cc.log("height="+this.height); n++; } img.src = uri; my.style.display='none'; my.style.visibility = "hidden"; } function tmpSelectFile(evt) { //console.log("image selected..."); var file = evt.target.files[0]; var type = file.type; if (!type) { type = mime[file.name.match(/\.([^\.]+)$/i)[1]]; } var url = myCreateObjectURL(file); loadLocalimg(url); } function myCreateObjectURL(blob){ if(window.URL !== undefined) return window['URL']['createObjectURL'](blob); else return window['webkitURL']['createObjectURL'](blob); }
帖子: 2
参与者: 1