function on_message(self, message_id, message, sender)
if message_id == hash("proxy_loaded") then
msg.post(sender, "init")
msg.post(sender, "enable")
msg.post(sender, "acquire_input_focus")
msg.post(".", "released_input_focus")
if check2 then
msg.post("list2:/list#gui", "testtt")
else
msg.post("list:/list#gui", "testt")
end
end
end
function on_input(self, action_id, action)
if action_id == hash("touch_r") and action.released then
msg.post("proxy#list2", "unload")
msg.post("proxy#list", "load")
msg.post(".", "released_input_focus")
check2 = false
elseif action_id == hash("enter") and action.released then
msg.post("proxy#list", "unload")
msg.post("proxy#list2", "load")
msg.post(".", "released_input_focus")
check2 = true
elseif action_id == hash("space") and action.released then
msg.post("proxy#list", "unload")
msg.post("proxy#list2", "unload")
end
When used like this, âunloadâ seems to be not recognized.
First, when you press âtouch_râ key and then âenterâ key, the screen when you press âtouch_râ key does not disappear.
Could you please add a print(message_id) at the top of on_message() just to see if you get a "proxy_unloaded" message? Do you see any errors in the console?
Put âprint (message_id)â at the top of âon_messageâ. The message is initially
DEBUG: SCRIPT: hash: [released_input_focus]
DEBUG: SCRIPT: hash: [proxy_loaded]
At the end,
DEBUG: SCRIPT: hash: [released_input_focus]
DEBUG: SCRIPT: hash: [proxy_unloaded]
Is displayed.
The messages clearly indicate that the unload was successful since you did in fact receive a proxy_unloaded message. You could also print(sender) just to be sure.
Iâm not sure what else to say, something is unloading as expected at least, but without knowing more about the setup it is impossible to say whatâs wrong. From the snippet of code it seems like you have two collection proxies; proxy#list and proxy#list2 and from the console log it can be seen that something is loaded and something else is unloaded.
What do you expect should happen and what is actually happening?
I expect that the list screen and the âlist2 screenâ alternate. However, when âlist screenâ is displayed, it does not change to âlist2 screenâ and âlist2 screenâ does not change to âlist screenâ.
So when I run âunloadâ from âaction_id == hash (âspaceâ)â and then do âloadâ, the output is what I expected.
But I want to solve âunloadâ and âloadâ at once with âaction_idâ.
Would you mind inviting me (bjorn.ritzl@king.com) to your project (using the Defold Dashboard) so that I can take a look? Donât forget to sync your changes!