主题:  图片点击放大,再点击缩小,问题求解

meng

职务:普通成员
等级:1
金币:0.0
发贴:1
注册:2007/11/24 18:41:50
#12008/7/11 16:24:57
property vStep,statu,orgRect
property pSprite
--存在问题:指定垂直步幅后,水平步幅有时会为0,需要进一步判断
-- 即使用水平步幅为1,放缩过程也很快,需要加延时处理
on beginSprite me
statu = false
pSprite = sprite(me.spriteNum)
orgRect = pSprite.rect
end

on mouseUp me
stageRect = _movie.stage.rect
stageCenter = point((stageRect.left+stageRect.right)/2,(stageRect.top+stageRect.bottom)/2)
orgCenter = point((orgRect.left+orgRect.right)/2,(orgRect.top+orgRect.bottom)/2)
stepNum = abs((orgCenter.locV - stageCenter.locV)/vStep)
if orgCenter.locV > stageCenter.locV then vStep = -1*vStep
hStep = (orgCenter.locH - stageCenter.locH)/stepNum
wStep = (stageRect.width - orgRect.width)/stepNum
hiStep = (stageRect.height - orgRect.height)/stepNum

if not statu then
repeat with i = 1 to stepNum
pSprite.width = pSprite.width - wStep
pSprite.height = pSprite.height - hiStep
pSprite.loch = pSprite.loch - hStep
pSprite.locV = pSprite.locV - vStep
end repeat
pSprite.rect = rect(0,0,stageRect.width,stageRect.height)
else
repeat with i = 1 to stepNum
pSprite.width = pSprite.width + wStep
pSprite.height = pSprite.height + hiStep
pSprite.loch = pSprite.loch + hStep
pSprite.locV = pSprite.locV + vStep
end repeat
pSprite.rect = orgRect
end if
statu = not statu
end
on getPropertyDescriptionList
zysList = []
zysList[#vStep] = [#default 5,#format#integer,#comment "100", #range [#min1,#max10]]
return zysList
end

---------------
三仙半老大给解了,遇到了问题,调进去老出问题,自己解决不了,求高手帮个忙,让这程序能正常运行,看看哪有问题。。。谢谢