With the latest display.newText object, I always do something like this to ensure I get the text object aligned and placed exactly where I want it:
[lua]local myTxt = display.newText(localGroup, “Very long, long, long,\nlong, long, long, long\nsentence I want to wrap.”, 0, 0, screenW*0.8, screenH*0.8, fontName, fontSize );
myTxt:setTextColor(255, 255, 255);
myTxt:setReferencePoint( display.TopLeftReferencePoint );
myTxt.x = screenW*0.25;
myTxt.y = 100;[/lua]
The key is to setReferencePoint AFTER the content of the text is defined, and then set the x-position AFTER the setReferencePoint. y-position probably does not need to be reset after the text & reference point are defined (unless your y-position isn’t at the upper/top of the sentence). For proper alignment, it’s always a good idea to set x-position after the text and reference point are set.
Keep in mind, if you update the text of the same object, you will need to re-set reference point and x-position. (This one is easy to forget and can cause grief.)
Naomi
[import]uid: 67217 topic_id: 24738 reply_id: 100350[/import]