Titanium Community Questions & Answer Archive

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

ImageView issues

I programmed this from looking at the API's, so I think I did it right. My issue is that the program is having different results with the same actions. I see the image correctly and then the next time I launch the app in the same session it is a black screen, then the next time it is the background color that was chosen and the default blank image showing it could not find or load the image. I am really confused with its schizophrenic behavior. Full code shown below.

code:
~~~levels.js - works perfectly - look below at linked problem file.
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
//Titanium.UI.setBackgroundColor('#000');

//var window = Titanium.UI.createWindow({
// title:'Ninja Star',
// backgroundImage:'../images/pageOptions.png',
// zindex:0
//});

var win = Ti.UI.currentWindow;
win.open({fullscreen:true});

var backgroundView = Titanium.UI.createView({
height:480,
width:320,
top:0,
left:0,
backgroundImage:'../images/pageOptions.png'
});
win.add(backgroundView);

//easy
var easy1 = Titanium.UI.createImageView({
url:'../images/text-easy-mouseover.png',
height:32,
width:73,
top:185,
left:120
});
win.add(easy1);

var easy2 = Titanium.UI.createImageView({
url:'../images/text-easy-mouseover2.png',
height:32,
width:73,
top:185,
left:120
});
//win.add(easy2);
//easy

//medium
var med1 = Titanium.UI.createImageView({
url:'../images/text-medium-mouseover.png',
height:40,
width:132,
top:250,
left:120
});
win.add(med1);

var med2 = Titanium.UI.createImageView({
url:'../images/text-medium-mouseover2.png',
height:40,
width:132,
top:250,
left:120
});
win.add(med2);

//medium

//hard
var hard1 = Titanium.UI.createImageView({
url:'../images/text-hard-mouseover.png',
height:40,
width:80,
top:335,
left:120
});
win.add(hard1);

var hard2 = Titanium.UI.createImageView({
url:'../images/text-hard-mouseover2.png',
height:40,
width:80,
top:335,
left:120
});
win.add(hard2);
//hard

//label-Directions
var labelDirect = Titanium.UI.createLabel({
text:'See Directions',
height:'auto',
width:'auto',
color:'#ccc',
font:{fontSize:20},
textAlign:'center',
top:430
});
win.add(labelDirect);
//label-Directions

win.open({fullscreen:true});

//Easy event
easy1.addEventListener('click', function()
{

var winEasy = Titanium.UI.createWindow({
url:'easy.js',
title:'Easy'});
winEasy.open({fullscreen:true});
win.close();

});
//End Easy event

//Medium event
med1.addEventListener('click', function()
{
var winMed = Titanium.UI.createWindow({
url:'views/medium.js',
title:'Easy'});
winMed.open({fullscreen:true});
win.close();
});
//End Medium event

//Hard event
hard1.addEventListener('click', function()
{
var winHard = Titanium.UI.createWindow({
url:'views/hard.js',
title:'Easy'});
winHard.open({fullscreen:true});
win.close();
});
//End Hard event

//Directions event
labelDirect.addEventListener('click',function()
{
var winDirect = Titanium.UI.createWindow({
url:'directions.js',
title:'Directions'});
winDirect.open({fullscreen:true});
win.close();

});
//End Directions event

~~~easy.js - problem file

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
//Titanium.UI.setBackgroundColor('#000');

var winEasy = Titanium.UI.createWindow({
//backgroundColor:'red',
//backgroundImage:'../images/pagePlay2.png'
});

var bgimage = Titanium.UI.createImageView({url:'../images/pagePlay.png'});
winEasy.add(bgimage);

winEasy.open({fullscreen:true});

— asked June 22nd 2010 by Jason Brock
  • imageview
  • issues
0 Comments

1 Answer

  • help me!

    — answered June 23rd 2010 by Jason Brock
    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.