I would build two lists; one list of rectangles, and one list of sizes, and initialize them as properties in your behavior:
property plRects -- property which is a list of rects property plSizes -- property which is a list of sizes property pnRectsAndSizes -- property which is the number of rects on beginSprite me plRects = [rect(-3, 36, 69, 75), rect(67, 46,105,75), ...] plSizes = ["8'x 4", "8'x 8", ...] pnRectsAndSizes = count(plRects) -- error check if pnRectsAndSizes <> count(plSizes) then alert("Not the same number of rects and sizes") end if end -- now check on mouseWithin using a repeat loop on mouseWithin theMouseLoc = the mouseLoc -- put it into a local variable for speed -- loop through all the rects repeat with i = 1 to pnRectsAndSizes -- Check if the mouse is within the current rect if inside(theMouseLoc, plRects[i]) then -- it is inside this rect, use the appropriate size member("rectfield").text = plSizes[i] return -- we're done end if end repeat -- if it fell through to here the mouse is not within any rect -- do whatever you want here, maybe set the text to an empty string member("rectfield").text = "" end Irv At 2:05 PM +0000 8/3/02, Chris Mealey wrote: >Hi >The purpose of script in question is for a user (a gardener) to be able >to layout >their garden > i.e. veggie plots, rows, in between rows ,paths, etc...by returning a > measurement i.e. 8'x16' or whatever dimension in a text member. > >I am using scalable sprite (plot) whose top left corner is anchored at >(0,0 >which is scaled when draggged by a (square handle) sprite which is >anchored at bottom right corner of scalable (plot) sprite. > >when the rect of this handle sprite is over a predetrermined rect of >grid sprite(garden area) >puts size of that "plot"(scalable sprite) into a text member. > >There's a score utility which puts rect(s) via handle sprite into a >field >so it's not too time consuming as far as developing goes >but man that's alot of if ..else's ..and.. end if's , 120 rects >Is there a case statement or other method? > >on mouseWithin me -- on the handle sprite > if inside(the mouseLoc,rect(-3,46, 69,75)) then > member("rectfield").text = "8'x 4'" > else > if inside(the mouseLoc,rect(67, 46,105,75)) then > member("rectfield").text = "8'x 8'" > else > if inside(the mouseLoc,rect(99,47,137,75)) then > member("rectfield").text = "8'x 12'" > else > if inside(the mouseLoc,rect(133, 46, 171, 75)) then > member("rectfield").text = "8'x 16'" > else > if inside(the mouseLoc,rect(167, 46, 205, 75)) then > member("rectfield").text = "8'x 20'" > else > > etc..... >thanks in advance > >[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!] -- Lingo / Director / Shockwave development for all occasions. (Home-made Lingo cooked up fresh every day just for you.) [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!]