Page 1 of 1

Help with multiple density image basics

Posted: Sat Nov 02, 2013 9:50 am
by doobox
Hi there,

I was just testing the multiple density image in 6.5(rc1)

Let me state my assumptions, and stop me when i am wrong please...

Creating a test stack for iPhone arm 7.
Created stack at 320x480.
Created 2 images (320x100),(640x200), the larger image has a red x on it.
Named the images myimage.png, and myimage@2x.png
Put both image files in copy files.
Imported the smaller image to the card.

Tested the stack in both the simulator and a real iPhone 5.

I expected to see the larger 2x image with the red x on it, but i always see the smaller image scaled.

Re: Help with multiple density image basics

Posted: Sat Nov 02, 2013 10:34 am
by doobox
Sussed it..!

At least i have found one way to see images at design time and then have those image behave properly at run time.

In my project folder i have a folder containing all my images, called "images".

Add the "images" folder to the copy files in standalone settings.

In the "images" folder have all my images as image.png and image@2x.png for example.

Now i can just import the smaller of the images to the card at design time, so i can see what i am doing.

In the card script i added :

Code: Select all

on preOpenCard
   repeat with x=1 to the number of images of this card
      put the short name of image x into tImageName
       set the filename of image x to specialfolderpath("engine") & "/images/" & tImageName
   end repeat
end preOpenCard
So at runtime this is switching out the source of all of the images to the images in the now included "images" folder, and the correct image 1x or 2x is indeed displayed.