Hello,
I am developing new app. using titanium 1.0 In that I am opening phtogallery in new window but I am not able to open it why this was happened?
Code to open photogallery in app.js
Titanium.App.addEventListener('recordvideo', function(e)
{
win1.close();
var w = Titanium.UI.createWindow({
backgroundColor:'#336699',
title:'Modal Window',
barColor:'black',
url:'xhr_testfileupload.js'
});
w.open({animated:true});
});
xhr_testfileupload.js code:
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 Image',
font:{fontSize:12, fontWeight:'bold'},
color:'#888'
});
win.add(ind);
ind.show();
Titanium.Media.openPhotoGallery({
success:function(event)
{
Ti.API.info("success! event: " + JSON.stringify(event));
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);
}
// open the client
xhr.open('POST','https://twitpic.com/api/uploadAndPost');
// send the data
xhr.send({media:image,username:'fgsandford1000',password:'sanford1000',message:'check me out'});
},
cancel:function()
{
},
error:function(error)
{
},
allowImageEditing:true,
});