I use sprite.visible all the time with no ill effect - as Mark points out it
is a channel property, not a sprite property, so any behavior that uses it
MUST include a sprite.visible = 1 in its endSprite handler. That's it. The
same goes for pSprite.cursor
Having another active sprite overlapping your menu could *maybe* cause the
mouse events to not work in some cases.
Also, as Warren stated - use behaviors & make them reuseable.
Here is your code as a more OO behavior. It's not finished - it just
replicates what you were doing in your original code so the mouseLeave stuff
is missing. It could be optimised a little more but this is for ease of
understanding. Sorry I don't have time to comment it.
Put this behavior on all the sprites that make up your menu & set the
parameters for each independently. You can group different menus & submenus
together by giving them the same group name, so you can have more than one
set of menus on stage at once.
Take the time to read & understand this approach to coding - it will never
be the same again. (No more hardcoding sprites/members/markers etc, faster,
reuseable, more reliable, smarter, encapsulated).
HTH
johnAq
---(Watch out for email line breaks)
property pSprite, pDefaultMember, pMouseEnterMember, pMouseDownMember
property pGroup, pTargetMarker, pMenuType
on beginSprite me
pSprite = sprite(me.spriteNum)
pDefaultMember = pSprite.member
if pMenuType = #menu then
pSprite.visible = 1
else
pSprite.visible = 0
end if
end
on endSprite me
pSprite.visible = 1
pSprite.cursor = -1
end
on mouseEnter me
pSprite.member = pMouseEnterMember
pSprite.cursor = 280
if pMenuType = #menu then
sendAllSprites(#showSubMenu, pGroup)
end if
end
on mouseLeave me
pSprite.cursor = -1
end
on mouseDown me
pSprite.member = pMouseDownMember
end
on mouseUp me
pSprite.member = pMouseEnterMember
if pMenuType = #menu then
sendAllSprites(#hideSubMenu, pGroup)
end if
go pTargetMarker
end
on getPropertyDescriptionList me
propList = [:]
propList[#pMenuType] = \
[#comment:"Menu Type:", \
#format:#symbol, \
#default:#submenu, \
#range:[#menu, #submenu]]
propList[#pMouseEnterMember] = \
[#comment:"Rollover Member:", \
#format:"member", \
#default:1]
propList[#pMouseDownMember] = \
[#comment:"Click Member:", \
#format:"member", \
#default:1]
propList[#pTargetMarker] = \
[#comment:"Click Target Frame:", \
#format:#marker, \
#default:1]
propList[#pGroup] = \
[#comment:"Menu Group Name:", \
#format:#String, \
#default:"Enter Group Name"]
return propList
end
-------------------------custom handlers
on showSubMenu me, theGroup
if pMenuType = #submenu AND theGroup = pGroup then
pSprite.visible = 1
end if
end
on hideSubMenu me, theGroup
if pMenuType = #submenu AND theGroup = pGroup then
pSprite.visible = 0
end if
end
----------------------------------------
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]