Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Change Window background image on change of orientation

I consult the sample on kitchensink but I need to know how to change the window background image on the fly.

I tried the following but it doesn't work

window.onload = function()
{
Titanium.Gesture.addEventListener('orientationchange',function(e)
{
var o = '';
if (Titanium.Gesture.isLandscape(e.to))
{
Titanium.UI.currentWindows.backgroundImage = "bg_day_landscape.png";
}
else if (Titanium.Gesture.isPortrait(e.to))
{
o = 'I am portrait';
}

});
— asked March 15th 2010 by Peter Lum
  • background
  • image
  • orientation
  • window
0 Comments

3 Answers

  • Instead of changing the background, why not have a view or just an ImageView that gets changed? Then you could animate the image change if you needed/wanted to.

    — answered March 15th 2010 by Clint Tredway
    permalink
    0 Comments
  • Can also try changing "currentWindows" to "currentWindow".

    — answered March 15th 2010 by Dan Giulvezan
    permalink
    0 Comments
  • Still doesn't work even I changed "currentWindows" to "currentWindow".

    Clint, would you describe how to do what you suggest in greater detail?

    I can't figure out what you mean.

    Thanks!

    — answered March 16th 2010 by Peter Lum
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.