Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Fill Gradient to a Vector Shape
Show Time
Direct TTS (Text to speech)
Slow Searches - Valentina
Minefield
Preload Frames
RADEMAIL
Video Sprite
Color Picker
CopyFiles form AnyPath Include CD-ROM,DVD,HDD...etc
MediaMacros Xtras Mall
 

 

 

Behavior Movable Hole with Mask Ink

Added on 7/8/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MatthewCaldwell

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 behavior

-- 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

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail