The way I implement such callbacks is by using a script local variable. In my script local variable, I have a handler that registers a callback. This handler will keep track of the target that registered the callback. When I need to send a callback later, I pick the original target from that variable.
I've edited the original code below: The stack script says: on openCard start using "minihttp.livecode" end openCard The card script says: on someHandler ... httpGet "http://blah.com","myCallback" end someHandler on myCallback ... -- do someting brilliant with the data we've requested end myCallback Finally, I have a stack called "minihttp.livecode". The stack script looks like: local sCallbackA on httpGet pUrl,pCallback -- save the callback put the target into sCallbackA["target"] put pCallback into sCallbackA["message"] -- kick off asynchronous httpGet operations with a local callback mysocketOpen "address","mySocketCallback" -- now return end httpGet on mySocketCallback args -- Yay! Finally have the data. Hand it back send sCallbackA["message"] to sCallbackA["target"] in 0 milliseconds end mySocketCallback _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
