Questions about proxy

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?

Okay.

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.

"released_input_focus"

change to:

"release_input_focus"

Thank you for pointing out my mistake. But the problem I want is not solved.

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?

1 Like

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!