Hi guys,
So I’ve had previous problems with label only buttons and their anchors but because of some friendly people in the forums, we found a workaround.
But another problem has risen, my code looks something like this:
---// CREATING CATEGORYSLIDEOUT \\--- categorySlideOut.mainRect = display.newRect(centerCor.addMainRectX \* 1.35, centerCor.addMainRectY \* 1.35, centerX \* 0.475, centerY \* 0.477) categorySlideOut.mainRect.anchorX = 0 centerCor.categorySlideOutX, centerCor.categorySlideOutY = categorySlideOut.mainRect:localToContent(0,0) categorySlideOut.divider1 = display.newRect(centerCor.categorySlideOutX, centerCor.categorySlideOutY \* 0.9225, categorySlideOut.mainRect.width, centerX\*0.005) categorySlideOut.divider1.fill = {0.4,0.4,0.4, 0.5} categorySlideOut.divider2 = display.newRect(centerCor.categorySlideOutX, centerCor.categorySlideOutY \* 1, categorySlideOut.mainRect.width, centerX\*0.005) categorySlideOut.divider2.fill = {0.4,0.4,0.4, 0.5} categorySlideOut.divider3 = display.newRect(centerCor.categorySlideOutX, centerCor.categorySlideOutY \* 1.0775, categorySlideOut.mainRect.width, centerX\*0.005) categorySlideOut.divider3.fill = {0.4,0.4,0.4, 0.5} categorySlideOut.friendButton = widget.newButton( { label = "Friend", labelColor = {default={0}, over={129/255, 202/255, 195/255}}, font = font.robotoM, fontSize = 15, embos = false, textOnly = true, x = centerCor.addMainRectX \* 1.375, y = centerCor.addMainRectY \* 1.195, onEvent = functions.categoryItemEvent, id = "friend" } ) categorySlideOut.friendButton.anchorX = 0 categorySlideOut.familyButton = widget.newButton( { label = "Family", labelColor = {default={0}, over={129/255, 202/255, 195/255}}, font = font.robotoM, fontSize = 15, embos = false, textOnly = true, x = centerCor.addMainRectX \* 1.375, y = centerCor.addMainRectY \* 1.3, onEvent = functions.categoryItemEvent, id = "family" } ) categorySlideOut.familyButton.anchorX = 0 categorySlideOut.strangerButton = widget.newButton( { label = "Stranger", labelColor = {default={0}, over={129/255, 202/255, 195/255}}, font = font.robotoM, fontSize = 15, embos = false, textOnly = true, x = centerCor.addMainRectX \* 1.375, y = centerCor.addMainRectY \* 1.4, onEvent = functions.categoryItemEvent, id = "stranger" } ) categorySlideOut.strangerButton.anchorX = 0 categorySlideOut.coworkerButton = widget.newButton( { label = "Coworker", labelColor = {default={0}, over={129/255, 202/255, 195/255}}, font = font.robotoM, fontSize = 15, embos = false, textOnly = true, x = centerCor.addMainRectX \* 1.375, y = centerCor.addMainRectY \* 1.5, onEvent = functions.categoryItemEvent, id = "coworker" } ) categorySlideOut.coworkerButton.anchorX = 0 categorySlideOut.hiddenTouchReceiver = display.newRect(centerX, originY, actualW, actualH \* 3) categorySlideOut.hiddenTouchReceiver.alpha = 0 categorySlideOut.hiddenTouchReceiver.isHitTestable = false categorySlideOut.hiddenTouchReceiver:addEventListener("tap", functions.dismissCategory) ----------------------------------------------------------------------------------------- categorySlideOutGroup.alpha = 0
This code creates a, and I admit messy, dropdown menu but the code itself should all be valid. All of the items are placed in a group called “categorySlideOutGroup” and at the end I set the alpha value to 0. So I open this menu with this function:
function functions.openCategory(event) if event.phase == "ended" then transitions.openCategory = transition.to(categorySlideOutGroup, {time = 200, transition = easing.outCubic, alpha = 1}) categorySlideOut.hiddenTouchReceiver.isHitTestable = true end return true end
That works completely as expected, but when I try to close it with this code:
function functions.dismissCategory(event) print("tapped the rect") transitions.openCategory = transition.to(categorySlideOutGroup, {time = 200, transition = easing.outCubic, alpha = 0}) categorySlideOut.hiddenTouchReceiver.isHitTestable = false return true end
I’m getting unwanted results. The transition does not apply to the labelOnly buttons. Instead, the text becomes white for a brief moment and after that just disappears. The transition is however okay with other objects in the group like the dividers and mainRect.
Is there any way of fixing this or will I have to transition all the objects separately?
Kind regards
Bram