Date: Thu, 1 Dec 1994 22:07:42 -0600 From: Matthew Caldwell <sexkittn@BURN.DEMON.CO.UK> Subject: Re: Movable Hole?OK, this is a little tricky, but not too much. The trick is to use the mask ink effect and move the mask around.
Immediately after your foreground pict in the cast, put a 1-bit picture castmember consisting of a huge black rectangle with a white circle the size of the hole you want in the middle of it. The rectangle needs to be large enough that its edges don't start to clip the foreground pict when you move the hole all the way to the edge.
Then, place foreground and background picts onstage, and set the foreground picts ink effect to "Mask".
Then, place a large invisible tools palette rectangle over the two picts, and give it the following sprite script:
-- handler to move a hole around under mouse control
-- maskCast is the cast containing the bitmap mask for the hole
-- note that the stuff involving eensy is a workaround for the
-- problem with stage updates not getting flushed properly: by moving
-- our invisible rectangle slightly we persuade Director that the
-- stage really does need updating.
on mouseDown
-- save our start position
put the mouseH into oldH
put the mouseV into oldV
-- set up the stuff for the update workaround
put -1 into eensy
put the clickOn into thisSprite
-- repeatedly move the mask in line with the cursor
repeat while the mouseDown
-- get the old regPoint
put the regPoint of cast maskCast into blah
put getAt(blah,1) into regH
put getAt(blah,2) into regV
-- get the new mouse position
put the mouseV into newV
put the mouseH into newH
-- work out how much we've moved
set hOffset = newH - oldH
set vOffset = newV - oldV
-- move the mask regPoint the same amount in the *opposite* direction
set the regPoint of cast maskCast = point(regH-hOffset, regV-vOffset)
-- shift the foreground sprite slightly to force an update
set the locH of sprite thisSprite = the locH of sprite thisSprite + eensy
-- make it shift *back* next time around
set eensy = -eensy
-- update
updateStage
-- save the new mouse position
set oldH = newH
set oldV = newV
end repeat
-- et voila!
end mouseDown
There is one disadvantage to this method, of course (ain't there always?).
Because the sprite boundaries are defined by the mask, the foreground pict
will be surrounded by empty whiteness obscuring any background, which means
anything you *would* have put behind it you have to put in front instead.
Life is hard.
____ \ / Matthew Caldwell <sexkittn@burn.demon.co.uk> \/ Hey Betty, is that Jimmy's ring you're wearing?