#92001/11/7 21:28:09
这是我98年写的程序,有兴趣可以研究一下。图要自己做。
你要例子的话,我也可以先做一个,以后发给你。
(?是Alt+Enter键)
property turnMenuMem,old_MenuMem
property farther,children
property specialChild
on BeginSprite me
set old_MenuMem = the member of sprite the spriteNum of me
sendSprite(farther,#addChildren,me)
end
on mouseEnter me
if farther then
set sp=the spriteNum of me
sendSprite(farther,#hideBorther,sp)
call(#open,me)
updatestage
end if
end
on rightMouseDown me
if farther=0 then
if (the member of sprite the spriteNum of me)=old_MenuMem then
set the visible of sprite specialChild to 1
updatestage
end if
end if
end
on mouseDown me
global Down
if farther=0 then
if (the member of sprite the spriteNum of me)=old_MenuMem then
call(#open,me)
set the visible of sprite specialChild to 0
else
call(#closeAll,me)
end if
else
set Down=1
end if
end
--on mouseUp me
-- pass
--end
on mouseLeave me
if farther then
if children=[] then
set sp=the spriteNum of me
set the member of sprite sp to old_MenuMem
end if
end if
end
on addChildren me,p
addat children,p
end
on closeAll me
call(#close,me)
repeat with n=1 to count(children)
set childSp=the spriteNum of getat(children,n)
sendSprite(childSp,#closeAll)
end repeat
end
on hide me
set sp=the spriteNum of me
set the visible of sprite sp to 0
end
on show me
set sp=the spriteNum of me
set the visible of sprite sp to 1
end
on open me
set sp=the spriteNum of me
set the member of sprite sp to turnMenuMem
call(#showChildren,me)
end
on close me
set sp=the spriteNum of me
set the member of sprite sp to old_MenuMem
call(#hideChildren,me)
end
on hideChildren me
repeat with n=1 to count(children)
set childSp=the spriteNum of getat(children,n)
set the visible of sprite childSp to 0
end repeat
end
on showChildren me
repeat with n=1 to count(children)
set childSp=the spriteNum of getat(children,n)
set the visible of sprite childSp to 1
end repeat
end
on hideBorther me,oneChild
repeat with n=1 to count(children)
set childSp=the spriteNum of getat(children,n)
if not(oneChild=childSp) then
sendSprite(childSp,#closeAll)
end if
end repeat
end
on getPropertyDescriptionList
if the currentSpriteNum= 0 then
set mem=0
else
set s= the currentSpriteNum
set m=the member of sprite s
set n= the memberNum of member m
set c= the castLibNum of member m
set nm=member (n+1) of castLib c
end if
set description=[?
#turnMenuMem:[#comment:"Change the Menu Option's member:",?
#format:#graphic,?
#default: nm],?
#farther:[#comment:"the Menu Option's Farther Name:",?
#format:#integer,?
#default:0],?
#children:[#comment:"the Menu Option's Children Names:",?
#format:#integer,?
#default:[]],?
#specialChild:[#comment:"Hide or Show Child Name:",?
#format:#integer,?
#default:0]]
return description
end