Date: Tue, 21 Mar 1995 00:33:08 +0000 From: Peter Small <peter@GENPS.DEMON.CO.UK> Subject: Re: How to make multiple "hot spots" on a moving bitmap? >Now, _I_ need an answer for this for a different reason. I'm doing an art >CD-Rom. I have about 200 images of the works in two sizes: one shows the >whole work and the other is a larger image which the user can drag about >the screen (these are almost 620 pixels wide, and sometimes 1400 pixels >high). > >I have about four "hotspots" on most of the smaller images which, when >clicked, display information (in a MIAW) about those specific details of >the work. I'd like to have those same areas of the work stay hot on the >enlarged images when the user drags it around the screen.This is where you can use the map function.
In the Lingo Dictionary, the map function (page 142) shows how you can position one rect in another in proportion to the relative positions of two other rectangles.
This also works with locs in rectangles.
For example, it you have a hotspot located at point(locH,loV) in a small rectangle rect(tl,tr,bl,br), you can find the corresponding position of that point in a larger rectangle rect(TL,TR,BR,BL) using the map function:
hotSpotLocInLargepoint = map(point(locH,loV),rect(tl,tr,bl,br),rect(TL,TR,BR,BL))A mouseUp script in one of the rectangles can reset all the four hotspots to the correct positions at the end of each move.
on mouseUp set the loc of sprite a1 to map(the loc of sprite x1,the rect of sprite y,the rect of sprite Z) set the loc of sprite a2 to map(the loc of sprite x2,the rect of sprite y,the rect of sprite Z) set the loc of sprite a3 to map(the loc of sprite x3,the rect of sprite y,the rect of sprite Z) set the loc of sprite a4 to map(the loc of sprite x4,the rect of sprite y,the rect of sprite Z) updateStage end