Fitting images

How do you get an image to fit for multiple devices full screen?

I tried it using:

local img1 = display.newImage(“wall.png”)

but it only shows up in the top left corner. How would I fix the dimensions for this image to take up the space of the whole screen regardless of which device? Also, how do you control user interaction, like if the user clicks this, this will happen…like which class’s method should I look into for that?

Thank you.

Hi @ipodthummy,

As a beginner, you should start with learning the basics of Corona. We offer many tutorials, guides, videos, and 3rd-party resources in Corona University, located here:

http://www.coronalabs.com/resources/tutorials/getting-started-with-corona/

Take care,

Brent

Thank you Brent! 

As Brent said, it’s really important to go through the basics. Don’t hesitate to click around the Corona Docs just to see what the API is capable of: http://docs.coronalabs.com/api/library/

In short, what you are looking to do is change the width and height properties of the image object “img1”. You can do that with the following two lines.

img1.width = display.contentWidth

img1.height = display.contentHeight

For the “interaction” portion of this, try searching the content library for Touch Handlers.

Hi @ipodthummy,

As a beginner, you should start with learning the basics of Corona. We offer many tutorials, guides, videos, and 3rd-party resources in Corona University, located here:

http://www.coronalabs.com/resources/tutorials/getting-started-with-corona/

Take care,

Brent

Thank you Brent! 

As Brent said, it’s really important to go through the basics. Don’t hesitate to click around the Corona Docs just to see what the API is capable of: http://docs.coronalabs.com/api/library/

In short, what you are looking to do is change the width and height properties of the image object “img1”. You can do that with the following two lines.

img1.width = display.contentWidth

img1.height = display.contentHeight

For the “interaction” portion of this, try searching the content library for Touch Handlers.