IE4 mouseUp workaround
February 12, 1998
by Andrew White
As I sure most of you are aware IE4 on the Mac fails to pass mouse up messages back to a Shockwave movie. Some of you may have come up with this work around already but this a skeltal button behavior to deal with this problem.
The basic idea is to have a stepframe handler which acts as a backup method in case the mouseUp event isn't caught by checking the mouseDown property to see whether the mouse button is still pressed. It works as normal in situations where the mouseUp event is passed and doesn't need to be updated once a fixed version of IE4 becomes available.
The only overhead imposed is a single if statement every time the playback head loops while the button is pressed. If the user clicks the button at a frequency greater than the frame rate then the number of button then it's possbile that an incorrect number of button clicks will be registered but I've not succeeded in doing this. It's also self-cleaning - no matter how vigorously the button is clicked no instances are left in the actorList.
-- Mac IE4 workaround button behavior
property spriteNum
property mouseDownMember
property mouseUpMember
property mouseDownMe
on beginSprite me
set mouseDownMe = FALSE
end
on mouseDown me
set mouseDownMe = TRUE
set the member of sprite spriteNum = ¬
member mouseDownMember
updateStage
add the actorList, me
end
on mouseEnter me
if mouseDownMe then
set the member of sprite spriteNum = ¬
member mouseDownMember
end if
end
on mouseLeave me
if mouseDownMe then
set the member of sprite spriteNum = ¬
member mouseUpMember
end if
end
on mouseUp me
update me
end
on mouseUpOutside me
updateOutside me
end
on update me
if mouseDownMe then
set the member of sprite spriteNum = ¬
member mouseUpMember
deleteOne the actorList, me
updateStage
set mouseDownMe = FALSE
-- Do your button action here
end if
end
on updateOutside me
if mouseDownMe then
set the member of sprite spriteNum = ¬
member mouseUpMember
deleteOne the actorList, me
updateStage
set mouseDownMe = FALSE
end if
end
on stepFrame me
if not the mouseDown then
if the rollover = spriteNum then
update me
else
updateOutside me
end if
end if
end
on getPropertyDescriptionList
set propList = [:]
set tempList = [:]
addProp tempList, #format, #graphic
addProp tempList, #default, 1
addProp tempList, #comment, "Up Member:"
addProp tempList, #range, #all
addProp propList, #mouseUpMember, tempList
set tempList = [:]
addProp tempList, #format, #graphic
addProp tempList, #default, 1
addProp tempList, #comment, "Down Member:"
addProp tempList, #range, #all
addProp propList, #mouseDownMember, tempList
return propList
end
Copyright 1997-2025, Director Online. Article content copyright by respective authors.