[Resolved] show image as thumbnail and zoom when touched

Hi All,

I am working with an app where I have to show an image in thumbnail format next to some text. If user touches the image it enlarge to cover the whole screen. Image has an X button in top left corner and if user touches the X button image zooms out and the same previous screen is shown with image as thumbnail. I may be asking too much but I will be very thankful if someone can guide me.
Thanks [import]uid: 126619 topic_id: 29042 reply_id: 329042[/import]

Try this, very rough plug and play sample for iPhone -

[lua]local obj = display.newRect(0,0,320,480)
obj:setReferencePoint(display.TopLeftReferencePoint)
obj.xScale, obj.yScale = 0.2, 0.1

local closeBtn = display.newRect( 0, 0, 20, 20 )
closeBtn:setFillColor(255, 0, 0)
closeBtn.isVisible = false

local function enlargeImg()
obj.xScale, obj.yScale = 1, 1
closeBtn.isVisible = true
end
obj:addEventListener(“tap”, enlargeImg)

local function pressClose()
obj.xScale, obj.yScale = 0.2, 0.1
closeBtn.isVisible = false
return true
end
closeBtn:addEventListener(“tap”, pressClose)[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 29042 reply_id: 116878[/import]

Thanks [import]uid: 126619 topic_id: 29042 reply_id: 116922[/import]

No worries, hope it helps you get started :slight_smile: [import]uid: 52491 topic_id: 29042 reply_id: 117003[/import]