Hi Everyone, Sorry I have not replied earlier. Thanks for the great response last night, as the points are allocated on a begin sprite only, I opted for having themselves add their vectors to a global list and running the handler from a moviescript called on a timeout - it's much much faster than I'd hoped.
So thanks to: Ken, Rob, Pedja, Valentin and Julian, I'd have never thought of the vector thing, I met the deadline and the client is super-happy. Many thanks Tim PS. I used a variation of the script below - only that I didn't need to create the vectors in the list on the fly. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 12 April 2006 02:50 To: [EMAIL PROTECTED]; Lingo programming discussion list Subject: RE: <lingo-l> Finding the closest point from a list of points in lingo > on getNearest pList,pCenter > pStartVector = vector(pCenter[1],pCenter[2],0) pDistance = 99999999999 > repeat with y in pList > pVector = vector(y[1],y[2],0) > pTemp = pVector.distanceTo(pStartVector) > if pTemp < pDistance then > pNearest = pVector pDistance = pTemp > end if > end repeat > > return pNearest > End [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
