Orientation issue

I’m kind of new to Corona.  I did a simple demo app a few months ago and now that the Starter edition is free I want to see what it can really do.  I am having trouble handling an orientation change.

So what I have is a group with it’s reference point set to center and and a text object inserted into the group.  Then I have a function to be called on orientation which calls another function that changes the location of the text object based on the orientation.  Seemed simple enough but the text object is visible only in the original orientation, the other three show nothing.  Here is the code:

local str = "Hello" local pt = 40 local screen = display.newGroup() screen:setReferencePoint(display.CenterReferencePoint) local myText = display.newText(str, 100, 100, system.nativeFontBold, pt) screen:insert(myText, true) local function showCenteredText(orientation) if (orientation == "landscapeLeft" or orientation == "landscapeRight") then myText.x = 240 myText.y = 160 else myText.x = 160 myText.y = 240 end end local function handleOrientation(event) showCenteredText(event.type) local newAngle = screen.rotation - event.delta transition.to(screen, {time=150, rotation=newAngle}) end showCenteredText() Runtime:addEventListener("orientation", handleOrientation)

Any ideas?  Thanks! :slight_smile:

Odd … When I add a background image it works as expected.

Odd … When I add a background image it works as expected.