CastName of Clicked Sprite

Date:    Thu, 22 Sep 1994 11:03:38 +0930
From:    Matt Craig <mnmac@FLINDERS.EDU.AU>
Subject: Re: whichSprite
Another method you can use is the mouseCast - this will give you the number of the cast under the mouse (in the uppermost channel) at the time you call it. If you need to get a sprite number from there...
on getSprite
  set myCast to the mouseCast
  -- quick check to see if the clickOn gets the right sprite/cast
  if the clickOn > 0 and the castNum of sprite the clickOn = myCast then
    set mySprite to the clickOn
  else
  --  this can be tedious, but it works (sort of)
    set dummyList to []
    repeat with i = 1 to 48 -- or whatever range of channels you choose
      setAt(dummyList,i,the castNum of sprite i)
    end repeat
    set mySprite to getOne(dummyList,myCast)
  end if
  return mySprite
end

BTW, I haven't checked this stuff, but the theory is sound (I think :)

The main problem with this approach is that getOne will find the first channel that myCast appears in, so if it is in channel 10 and 11, and you clicked on sprite 11 - this will return mySprite = 10

Anyway, it's something to play around with