Display.Newimage works on simulator but not Droid

I have a function that changes an image when a button is clicked. Works fine in simulator, but not on Droid.

function ChangeImage(QString)  
  local ImageString =examplemod.returnImage(QString)
  ch2=display.newImage(ImageString)
  ch2.x=xx
  ch2.y=yx
  yx=yx-20
  xx=xx-20
 end

What is the error that you are receiving from the device?

Very weird. No error. and it works fine in simulator.

The #1 reason (by far) for “It works in the sim but not on the device” is a filename problem. Filenames on device are case sensitive and in the sim they are not.  I would check that.  There should be a warning about not being able to find the file in your console log.

Can you do a print() on ch2, ch2.x, and ch2.y

Please make sure to read this blog:  http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

to look at the device’s console log.  You won’t see the error on your screen.

Rob,

You were correct. Filename, although it was displaying it correctly for the first image. Learned a valuable lesson, though,

and will learn console checks.

Thanks guys, much appreciated on a Saturday.

Carey

What is the error that you are receiving from the device?

Very weird. No error. and it works fine in simulator.

The #1 reason (by far) for “It works in the sim but not on the device” is a filename problem. Filenames on device are case sensitive and in the sim they are not.  I would check that.  There should be a warning about not being able to find the file in your console log.

Can you do a print() on ch2, ch2.x, and ch2.y

Please make sure to read this blog:  http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

to look at the device’s console log.  You won’t see the error on your screen.

Rob,

You were correct. Filename, although it was displaying it correctly for the first image. Learned a valuable lesson, though,

and will learn console checks.

Thanks guys, much appreciated on a Saturday.

Carey