Date: Thu, 14 Dec 1995 02:07:08 +0000 From: Matthew Caldwell <sexkittn@BURN.DEMON.CO.UK> Subject: colour cursors/fun with objects >Does anyone have a way of changing the fore/back color of a 1 bit cursor, >or do they have to be B+W?They have to be b&w. Standard xplatform workaround is to hide the cursor and puppet a picture sprite to track the mouse. This is a perfect candidate for p/c scripting using the actorList, because it's asynchronous and generalized, so here's a utility class to do it:
------------------------------------------------------------------
-- parent script for an object to manage cursors easily --
-- advantages -- takes care of itself and doesn't require --
-- a repeat loop that starves other parts of the movie --
-- disadvantages -- requires a permanently puppeted channel --
-- (48, since cursors must be at the front) to work with, --
-- adds a global, and will starve if some other part of --
-- the movie sits in a repeat loop or executes a "pause" --
------------------------------------------------------------------
on birth me
-- note that this birth creates its own global rather
-- than returning itself -- this is often not good practice
-- but it keeps everything self-contained here
global gCursor
set gCursor = me
puppetSprite 48, true
end birth
------------------
on mSet me, whichCast
-- hide the real cursor and place the substitute cast in the
-- topmost channel
cursor 200
set the castNum of sprite 48 = whichCast
-- put ourselves in the actorlist if we aren't there
-- already
if not getOne(the actorList, me) then add(the actorList, me)
stepFrame me
end mSet
------------------
on mReset me
-- reshow the default cursor and hide the topmost sprite
cursor 0
set the castNum of sprite 48 = 0
-- remove ourselves from the actorlist
deleteOne(the actorList, me)
end mReset
------------------
on stepFrame me
-- follow the mouse
set the loc of sprite 48 = point(the mouseH, the mouseV)
end stepFrame
------------------
(this was extemporized at the keyboard, so there may be a few errors, but
I've used this class before & it works)
Usage:
birth script("cursor object script")
global gCursor mSet gCursor, myCast(you can do this multiple times in a row without having to reset it in between)
global gCursor mReset gCursor