How can I set a background image for the window I'm in?
I've tried the following code but I'm not sure why it doesn't work. It opens up the gallery, I choose a photo and it returns me to the gallery, but the background doesn't change.
Any thoughts?
button.addEventListener('click', function() {
Titanium.Media.openPhotoGallery({
success: function(event) {
var image = event.media;
win.backgroundImage = null;
win.backgroundImage = image.nativePath;
},
cancel: function(){},
error: function(error) {}
});
});
1 Answer
-
Replace image.nativepath with image only.
Use below codebutton.addEventListener('click', function() { Titanium.Media.openPhotoGallery({ success: function(event) { var image = event.media; win.backgroundImage = null; win.backgroundImage = image; }, cancel: function(){}, error: function(error) {} }); });