newImageRect doesn't support setReferencePoint

Seems like newImageRect doesn’t support setReferencePoint

[lua]local w = 50
local h = 100

local group = display.newGroup()

local up = display.newImageRect(“images/up.png”, w, h)
up:setReferencePoint(display.TopLeftReferencePoint)

local box = display.newRect( 0, 0, w + 5, h + 5)
box:setReferencePoint(display.TopLeftReferencePoint)
box:setFillColor( 100, 0, 0, 100 )

group:insert(box)
group:insert(up)
group:setReferencePoint(display.TopLeftReferencePoint)[/lua] [import]uid: 616 topic_id: 7970 reply_id: 307970[/import]

Found out that you have to manually set the reference point as:

[lua]local w = 50
local h = 100

local group = display.newGroup()

local up = display.newImageRect( “images/up.png”, w, h )

– Doesn’t work: up:setReferencePoint(display.TopLeftReferencePoint)

– Manually set reference point on newImageRect
up.xReference = -w / 2
up.yReference = -h / 2
up.x = 0
up.y = 0

local box = display.newRect( 0, 0, w + 5, h + 5)
box:setReferencePoint(display.TopLeftReferencePoint)
box:setFillColor( 100, 0, 0, 100 )

group:insert(box)
group:insert(up)
group:setReferencePoint(display.TopLeftReferencePoint)[/lua] [import]uid: 616 topic_id: 7970 reply_id: 28467[/import]

Thanks, this was very helpful! I couldn’t figure out why my image went way off the screen whenever I tried to use the dynamic resolution with newImageRect – now I see that it was putting the center of the image at 0,0 unless I reset the reference point.

Sure would be nice to have a dynamic resolution sample program, hint hint! [import]uid: 20217 topic_id: 7970 reply_id: 34927[/import]