Page 1 of 1

Images not displaying on device, OK in simulator

Posted: Wed Dec 21, 2011 6:35 pm
by seamus_waldron
My stack is designed in the LiveCode environment for a regular (non retina) iOS display

My directory structure look like this:

./assets/iphone/
.assets/iphoneX2/

The stack uses images from ./assets/iphone/ and the images in the iPhone and iphoneX2 directory have the same names, just different dimensions for the different screen sizes.

If I detect that I am running on a retina display, my code loops through all my images and replaces /iphone/ in the filename with /iphoneX2/

I then re-position the images and various other positioning things

In the simulator, this all works just fine. The retina images get brought in and the app works fine.

The moment I deploy to a retina device, I hit trouble. None of the images display.

They are definitely being copied over to the device, so that is not the problem.

Any suggestions to get these images to show would be most gratefully received!

Regards

Seamus

Re: Images not displaying on device, OK in simulator

Posted: Wed Dec 21, 2011 9:39 pm
by jacque
This is almost always a file path issue. What are you using in your script to get the image paths? is it using specialFolderPath("engine") rather than the dot-slash at the front?

Re: Images not displaying on device, OK in simulator

Posted: Wed Dec 21, 2011 10:50 pm
by seamus_waldron
Bingo!

I am kicking myself as this was a solution I solved 10 months ago for getting to audio files and I had completely forgotten.

So,my code looks like this:

Code: Select all

   repeat with x = 1 to the number of images on this card
      put the topLeft of image X into localTopLeft
      put the filename of image X into  localFilename
      
      replace "iphone" with "iphoneX2" in localFilename
      replace "./assets/" with specialFolderPath("engine") & "/assets/" in localFilename
      
      set the filename of image X to localFilename 
      
      set the topleft of image x to localTopLeft
   end repeat
In essence, what this does is loop through all the images on the card and replaces them with the X2 version.

Many thanks for the tip.

Re: Images not displaying on device, OK in simulator

Posted: Wed Dec 21, 2011 11:01 pm
by jacque
I wish I only forgot one thing. :)