steve10 wrote:SparkOut wrote:get a reference to the target object
I suspect this is where I'm going wrong. What do you mean? Perhaps you could provide an example?
I thought that was an example

The lines you are quoting are comments in the handler that precede the actual codeline, to describe what we were doing. So the "get a reference to the target object" comment referred to the code line "put the long name of the target into obStart", which is actual syntax.
steve10 wrote:SparkOut wrote:put the long name of the target into obStart
That's what I thought I was doing with this code: put image "outer" into obStart
"put the long name of the target into obStart" was the actual syntax to do this. I was under the impression that you had a number of different images, each with their own name and id, and one group or card script with the mouseDown handler that would be caught and is intended to deal with the different images the same way, but with a reference to whichever on actually had the mouseDown action initiated. So say it was image "outer" that had the mouseDown event happen, and not the image "canoe" or image "balloon" that cold equally have been handled. When the mouseDown message reaches the card script handler we can find which of the images it was which originated the message by use of the keyword "target". So we were able to "put the long name of the target into obStart" which means that in this case the long name of image "outer" of (the current card...) was stored.
steve10 wrote:SparkOut wrote:check the target is actually an image
I'm not sure how to check, but it is an imported png. I suspect that's why part of the error message is "...near "‰PNG"...". Of course, checking in the real script is probably a good idea.
"-- check the target is actually an image" was a comment to describe this codeline: if word 1 of obStart is "image" then...
Having retrieved the long name of the target, obStart will look something like:
image "outer" of card 1002 of stack "path and name of/myTestStack.livecode"
so if the first word (word 1) of that long name (held in obStart) is "image" then we know it is an image that generated the message. I put that test in because I didn't think you would want the mouseDown handler to trigger off the resetToFirst handler for any field or other object on the card, or the card itself.
steve10 wrote:I'm not sure what you mean by the rest of it, but it may be worth pointing out that I didn't really need to image "outer2" and obEnd in this example. I violated the KISS principle! Outer and outer2 are different images and the use of "2' holds no significance. I'm not trying to put obStart into obEnd and copying doesn't seem to apply.
Steve
Ah, well the rest of it isn't likely to be too relevant (either). I was trying to help you achieve being able to find a way programmatically to reference which image was the source of a message. I believe I misunderstood you and you were simply trying to get the "reference" to the object (image "outer") to be passed to the resetToFirst handler. Which, as you have now seen from Klaus' post, is quite simple to do once you have been shown the syntax you need.