hidingPointer

  how to make a Global Frame Script and hide the mouse pointer until a move
oop cursor




  hiding the pointer
>The problem with everybody's suggestion is that you have to detect the mouse
>movement in a frame script.  That means that you have to have the show
>looping on a single frame or you'd have to put a script in every single
>frame.  Is there a way to make a sort of GLOBAL FRAME SCRIPT?
>

Hi Cody,

I think this question leads quite naturally to how wonderful parent scripts can be
Whether you power them via the actorlist (which isn't particulary chic) or have a behavior 
sitting on some sprite doing this or have your own timer obj: anyhow those objects have their 
own ways to get things done and you need not care for them in endless framescripts.
Once started all you have to worry about is how to get rid of them later. This is the hard bit.

The parent script below does hide the cursor until it is moved (while filtering minimal movements) 
and will hide it again a while after the movement has ended.

Best regards

Daniel Plaenitz
<http://www.lingo.de>


-- Hide Cursor - Obj
--

-- set t= new(script "hidecursorObj")
-- init(t)
-- add the actorlist,t


-------------

property  myMouseLoc, myTicks, myWait

on new me
  return me
end

on init me
  set myTicks = the ticks
  set myWait = 40
  set myMouseLoc = point(the mouseH, the mouseV)
end

on demolish me
  cursor -1
end

on hasMoved me
  -- monitor mouse movements but filter minimal movements 
  set erg=FALSE
  set off=myMouseLoc - point(the mouseH,the mouseV)
  
  if abs(the locH of off ) > 1 or abs(the locV of off ) > 1 then 
    set erg=TRUE
    set myTicks = the ticks
  end if
  
  set myMouseLoc = point(the mouseH,the mouseV)
  return erg
end

on inLatency me
  -- leave the cursor visible for a moment after the move stopped
  if myTicks + myWait > the ticks then return TRUE
end


on stepFrame me
  if hasmoved(me) or inLatency(me) then 
    cursor -1
  else
    cursor 200
  end if
end


Home shock + cgi Bits 'n pieces Director Lingo Shocklets Contact










pageID=l_hidingPointer