Is it possible to have a single object with multiple states or functionality
for instance I have a Tarot card on screen when I touch it the first time I want it to fill the left hand side of the screen via a transition (landscape mode) on the right a card description appears using a scrollview group. No problems so far. but I want to be able to click on the same card and bring up a menu which allows you to change the text on the right.
I have tried removing the event listener once the card is in place and replacing it with a new listener but having real problems with errors.
[lua]function BigCard2 ()
if bigcard1 == true then
card:removeEventListener (“touch”, movecard)
card:addEventListener ( “touch”, MenuAppear )
State = function MenuAppear
print (“Big Card = True”)
else
card:removeEventListener (“touch”, MenuAppear)
card:addEventListener ( “touch”, movecard )
– State = function movecard
print (“Big Card = False”)
end
end[/lua]
I’m sure there is a better/simpler way of doing this.
I don’t want to toggle the functionality I just want 2 states (or more if need be) and be able to choose when that functionality changes.
State 1: Transition card
State 2: Call Menu
Many thanks for any help to this noob!
[import]uid: 142733 topic_id: 25477 reply_id: 325477[/import]
