Date:    Thu, 8 Feb 1996 06:16:27 -0500
From:    "Glenn M. Picher" <gpicher@MAINE.COM>
Subject: Re: Eating Events

>  but the
>  mouseDown event is still in the event queue, and is immediately
>  processed in the new frame. (There was never an "on mouseDown"
>  script.) Any ideas on how I can easily "eat" the mouseDown event?

--Movie script
global eatMe

on startMovie
  set eatMe to 0
  set the mouseDownScript to "maybeEat()"
  set the mouseUpScript to "maybeEat()"
end

on maybeEat
  if eatMe then
    dontpassevent
    set eatMe to eatMe - 1
  end if
end

--Dispatching frame
on enterFrame
  if the mouseDown then
    --wait for the mouseUp
    repeat while the mouseDown
      nothing
    end repeat
    set eatMe to 2 --eat the next mouseDown and mouseUp events
    go to frame "next"
    return
  end if
end

--Target frame "next"
global eatMe

on enterFrame
  set eatMe to 0 --It already is, though, so it's not really necessary
end

This isn't totally bulletproof, though, because a user with click-itis can confuse things. You could just trash all mouseclicks by treating eatMe as a true/false value instead of an event count.

Another approach is to use the Flush (Johnny?) XObject from the MediaBook CD to clear all waiting input events. There's an equivalent on Windows on the MediaBook CD, but I don't remember its name.

- Glenn M. Picher                  Dirigo Multimedia    (207)767-8015
- gpicher@maine.com                http://www.maine.com/shops/gpicher
- Freelance Lingo and XObject/Xtras coding from Cape Elizabeth, Maine