#82004/7/8 14:33:12
这是我写的一个单选按钮的程序
因为我用的是日文系统,所以就没写comment
你把它复制到你的脚本里面
然后拖到按钮上面看看和你写的程序有什么不同
--ccBtn
--cc'radiobutton
--2004-03-24
--because japenese system so no comment
property ancestor
property spriteNum
property nMember
property nAction
property nNormal
property nRoll
property nDown
property nDisable
property nState
property nSound
property nChannel
property nCommand
property nBeginSpriteNum
property nEndSpriteNum
property nRadioBtn
on beginSprite me
nMember = sprite( spriteNum ).member
nAction = 0
if nState then
sendSprite( spriteNum, #ccEnable )
else
sendSprite( spriteNum, #ccDisable )
end if
if marker(0) =marker(nCommand) then
me.mouseup()
else if marker(0)=marker("ST") then
repeat with i=nBeginSpriteNum to nEndSpriteNum
sendSprite( i, #ccEnable )
end repeat
else if marker(0)= marker("ED") then
repeat with i=nBeginSpriteNum to nEndSpriteNum
sendSprite( i, #ccEnable )
end repeat
end if
-- if marker(0) =marker(nCommand) then
-- repeat with i=nBeginSpriteNum to spritenum-1
-- sendSprite( i, #ccEnable )
-- end repeat
--
-- repeat with i=spritenum+1 to nEndSpriteNum
-- sendSprite( i, #ccEnable )
-- end repeat
--
-- if nState then
-- SetAction( 2 )
-- sound( nChannel ).play( nSound )
-- go to nCommand
-- end if
-- sendSprite( spritenum, #ccDisable )
-- end if
end
on endSprite me
sprite( spriteNum ).member = nMember
end
on mouseDown me
if nState then
SetAction( 2 )
sound( nChannel ).stop()
end if
end
on exitframe me
end
on mouseUp me
repeat with i=nBeginSpriteNum to spritenum-1
sendSprite( i, #ccEnable )
end repeat
repeat with i=spritenum+1 to nEndSpriteNum
sendSprite( i, #ccEnable )
end repeat
if nState then
SetAction( 2 )
sound( nChannel ).play( nSound )
go to nCommand
end if
sendSprite( spritenum, #ccDisable )
cursor 0
end
on mouseenter me
if nState=false then
nothing
else
cursor 280
end if
end
on mouseleave me
cursor 0
end
on mouseUpOutside me
if nState then SetAction( 0 )
end
on prepareFrame me
if not nState then exit
case nAction of
0 : if rollover( spriteNum ) = true then SetAction( 1 )
1 : if rollover( spriteNum ) = false then SetAction( 0 )
end case
end
on ccDisable me
if nRadioBtn then
SetAction( 3 )
nState = false
else
end if
end
on ccEnable me
if rollover( spriteNum ) then
SetAction( 1 )
else
SetAction( 0 )
end if
nState = true
end
on SetAction n
case n of
0 :
sprite( spriteNum ).member = nNormal
nAction = 0
1 :
sprite( spriteNum ).member = nRoll
nAction = 1
2 :
sprite( spriteNum ).member = nDown
nAction = 2
3 :
sprite( spriteNum ).member = nDisable
nAction = 3
end case
end
on getPropertyDescriptionList me
m = sprite( the currentSpriteNum ).member.number
list=[:]
setaprop list,#nNormal,[#comment:"Normal",#format:#graphic,#default:member(m)]
setaprop list,#nRoll,[#comment:"Roll",#format:#graphic,#default:member(m+1)]
setaprop list,#nDown,[#comment:"Down",#format:#graphic,#default:member(m+2)]
setaprop list,#nDisable,[#comment:"Disable",#format:#graphic,#default:member(m+2)]
setaprop list,#nState,[#comment:"Init State",#format:#boolean,#default:true]
setaprop list,#nRadioBtn,[#comment:"RadioBtn???",#format:#boolean,#default:true]
setaprop list,#nChannel,[#comment:"Sound Channel",#format:#integer,#default:2,#range: [1, 2, 3, 4, 5, 6, 7, 8]]
setaprop list,#nSound,[#comment:"Sound Member",#format:#sound,#default:"bloop"]
setaprop list,#nBeginSpriteNum,[#comment:"BeginSpriteNum",#format:#integer,#default:124]
setaprop list,#nEndSpriteNum,[#comment:"EndSpriteNum",#format:#integer,#default:139]
setaprop list,#nCommand,[#comment:"Go to which marker",#format:#string,#default:"" ]
return list
end
on isOKToAttach (me, aSpriteType, aSpriteNum)
tIsOk = 1
if aSpriteType = #script then
tIsOK = 0
end if
return(tIsOK)
end on