Dynamic image not working

I am hoping that I am missing something obvious but I cannot get dynamic images to load. It uses the default always. 

This is the config file


– CODE 


application = {

    content = {

        width = 320,

        height = 480, 

        scale = “letterbox”,

        fps = 30,

        

        

        imageSuffix =

        {

            ["@1-5"] = 1.5, – for Droid, Nexus One, etc.

            ["@2x"]  = 2,   – for iPhone, iPod touch, iPad1, and iPad2

            ["@3x"]  = 3,   – for various mid-size Android tablets

            ["@4x"]  = 4,   – for iPad 3

        },

        

    },

}


– END CODE 


And the image is called using 


– CODE 


    local img   = display.newImage(“images/home_sunmoon.png”, 228, 229)

    img.pName   = “sun”

    img:setReferencePoint(display.CenterReferencePoint)

    img.x       = display.viewableContentWidth*.5 - 10

    img.y       = display.viewableContentHeight*.5

    img.alpha   = 0

    transition.to( img, { time=2000, delay=100, alpha=1.0, } )

    screenGroup:insert(img)


– END CODE 


The smallest image is 228 x 229

The image names are as follows:

home_sunmoon.png

home_sunmoon.png

home_sunmoon@2x.png

home_sunmoon@3x.png

home_sunmoon@4x.png

home_sunmoon@1-5.png

The display.newImage() does not use content scaling.  Use display.newImage_ Rect _() instead.  It does require the image width and height, where display.newImage() does not.

Haha! I was looking at the same line of code for a long time. Talk about forest through the trees. That worked perfectly! I wonder why Corona even has display.NewImage() at all considering that almost every app will be multi-device.

Thanks for your help!

display.newImage is good for when you don’t know the size of the image and want to scale it to an arbitrary size.  It’s also older, kind of predates the display.newImageRect() and the dynamic scaling.

home_sunmoon.png

home_sunmoon@2x.png

home_sunmoon@3x.png

home_sunmoon@4x.png

home_sunmoon@1-5.png

The display.newImage() does not use content scaling.  Use display.newImage_ Rect _() instead.  It does require the image width and height, where display.newImage() does not.

Haha! I was looking at the same line of code for a long time. Talk about forest through the trees. That worked perfectly! I wonder why Corona even has display.NewImage() at all considering that almost every app will be multi-device.

Thanks for your help!

display.newImage is good for when you don’t know the size of the image and want to scale it to an arbitrary size.  It’s also older, kind of predates the display.newImageRect() and the dynamic scaling.