I’m working off the list1 example.
How do i designate ware I want to put the text object other than the center of the detail screen?
i would like to place in the top left corner as I have a few lines of detail I want to place on the screen.
I’ll past the list example hear with what I tried. If you have a good over view on how to figure the cooridantes for the placment I would be very greatfull as hard coded numbers wont work on differnt devices.
thanks
–initial values
local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight
local myList, backBtn, detailScreenText
local background = display.newRect(0, 0, display.contentWidth, display.contentHeight)
background:setFillColor(77, 77, 77)
–setup a destination for the list items
local detailScreen = display.newGroup()
local detailBg = display.newRect(0,0,display.contentWidth,display.contentHeight-display.screenOriginY)
detailBg:setFillColor(255,255,255)
detailScreen:insert(detailBg)
detailScreenText = display.newText(“Thanks for Tapping IN”, 0, 0, native.systemFontBold, 24)
detailScreenText:setTextColor(0, 0, 0)
detailScreen:insert(detailScreenText)
–place text center of screen
–detailScreenText.x = math.floor(display.contentWidth/2)
–detailScreenText.y = math.floor(display.contentHeight/2)
detailScreen.x = display.contentWidth
print(detailScreen.x)
–setup functions to execute on touch of the list view items
function listButtonRelease( event )
self = event.target
local id = self.id
print(self.id)
detailScreenText.text = "Recipe "… self.id
detailScreenText.x= 0 – What I tried
detailScreenText.y= 0 – What I tried
transition.to(myList, {time=400, x=display.contentWidth*-1, transition=easing.outExpo })
transition.to(detailScreen, {time=400, x=0, transition=easing.outExpo })
transition.to(backBtn, {time=400, x=math.floor(backBtn.width/2) + screenOffsetW*.5 + 6, transition=easing.outExpo })
transition.to(backBtn, {time=400, alpha=1 })
delta, velocity = 0, 0
end
[import]uid: 5297 topic_id: 16015 reply_id: 316015[/import]