我正在开发新的应用程序。使用钛 1.0 因为我在新窗口中打开相册,但我无法打开它,为什么会发生这种情况?
在 app.js 中打开相册的代码
Titanium.App.addEventListener('recordvideo', function(e) { win1.close();
var w = Titanium.UI.createWindow({
backgroundColor:'#336699', title:'模态窗口', barColor:'black', url:'xhr_testfileupload.js' });
w.open({animated:true});
});
xhr_testfileupload.js 代码:
var win = Titanium.UI.currentWindow;
var ind=Titanium.UI.createProgressBar({ width:200, height:50, min:0, max:1, value:0, style:Titanium.UI.iPhone.ProgressBarStyle.PLAIN, top:10, message:'Uploading图片', 字体:{fontSize:12, fontWeight:'bold'}, 颜色:'#888' });
win.add(ind); ind.show();
Titanium.Media.openPhotoGallery({
成功:函数(事件){ Ti.API.info(“成功!事件:” + JSON.stringify(事件));var image = event.media;
var xhr = Titanium.Network.createHTTPClient();
xhr.onerror = function(e) { Ti.API.info('IN ERROR' + e.error); }; xhr.onload = function() { Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState); }; xhr.onsendstream = function(e) { ind.value = e.progress ; Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress); } // 打开客户端 xhr.open('POST',' https://twitpic.com/api/uploadAndPost ');
// 发送数据 xhr.send({media:image,username:'fgsandford1000',password:'sanford1000',message:'check me out'});
},取消:函数(){
},错误:函数(错误){},允许图像编辑:真,});