Button being clicked when changing state

69 Views Asked by At

When I click on the blue Favorites button in screen 1, I want to bring up the list of favorites (screen 2) and then click on the green Favorites button to get to screen 3. However, when I click on the Favorites button in screen 1, I immediately go to screen 3. How do I fix this?

||----------Screen 1 -----------||------------ Screen 2 ---------||-----------Screen 3-----------||

enter image description here enter image description here enter image description here

Code

#Show favorites page (Click blue favorites button)
$.favoritesButton.on Events.Click, ->
    #Show list of names
    $.otherCellsClickFavPage.states.switch("on")
    $.nameClickFavPage.states.switch("on")
    $.checkClickFavPage.states.switch("on")

    #Hide blue favorites button & show green favorites button 2
    $.favoritesButton.states.switchInstant("default")
    $.favoritesButton2.states.switch("on")

#Send to all favorites (Click on the green favorites button 2)
$.favoritesButton2.on Events.Click, ->
    #Show Send to All Favorites Page
    $.favoritesButtonSentToAllFav.states.switch("on")
    $.sentMessageSentToAllFav.states.switch("on")
    $.cellsSentToAllFav.states.switch("on")

    #Hide green favorites button 2 & blue favorites button, so can show pink + white favorites button
    $.favoritesButton2.states.switch("default")
    $.favoritesButton.states.switch("default")

State "on" means turn opacity to 1 and state "default" means opacity to 0. The green Favorites button 2 is on top of the blue Favorites button.

1

There are 1 best solutions below

0
On BEST ANSWER

Solved! I realized I just needed to move the blue Favorites button on top of the green Favorites button.

#Place Favorites button on top of favorites button 2
$.favoritesButton.placeBefore($.favoritesButton2)

#Show favorites page (Click favorites button)
$.favoritesButton.on Events.Click, ->
    #Show list of names
    $.otherCellsClickFavPage.states.switch("on")
    $.nameClickFavPage.states.switch("on")
    $.checkClickFavPage.states.switch("on")

    #Hide blue favorites button & show green favorites button 2
    $.favoritesButton.states.switchInstant("default")
    $.favoritesButton2.states.switch("on")

    #Place Favorites button 2 on top of favorites button
    $.favoritesButton2.placeBefore($.favoritesButton)

#Send to ALL favorites (Click on the green favorites button 2)
$.favoritesButton2.on Events.Click, ->
    #Show Send to All Favorites Page
    $.favoritesButtonSentToAllFav.states.switch("on")
    $.sentMessageSentToAllFav.states.switch("on")
    $.cellsSentToAllFav.states.switch("on")

    #Hide green favorites button 2 & blue favorites button, so can show     pink + white favorites button
    $.favoritesButton2.states.switch("off")
    $.favoritesButton.states.switch("off")

State "off" means turn opacity to 0.