I’m trying to insert a newImageRect object and then rotate it according to the device’s orientation (i.e. I want “up” on the image to be “up” on the display).
local img = display.newImageRect( fname, 100,100 ) img:setReferencePoint( display.CenterReferencePoint ) img.touch = processTouch img:addEventListener( "touch", img ) img.x = display.contentWidth \* 0.50 img.y = display.contentHeight \* 0.50 if( (scene.orientation=="portrait") or (scene.orientation=="portraitUpsideDown") ) then -- no rotation needed elseif( (scene.orientation=="landscapeLeft") or (scene.orientation=="landscapeRight") ) then print( "rotating image at creation time" ) img:rotate( math.pi/2 ) end gfxArea:insert( img )
The img:rotate command executes (I can see the print-out), but the object itself isn’t rotated. If I rotate the object later (in response to device orientation change), then it DOES rotate properly … it just won’t do it at creation time.
Any ideas?