|
主题: 关于滚动条
|
 toto
职务:版主
等级:5
金币:17.0
发贴:2582
|
#12000/11/30 10:07:52
我知道如果在直接DR中做类似 windows的滚动条,但现在是用photoshop画出的这样子怎么实现呢? 另外还要在文本上加上程序? 请教了
|
 我是小马
职务:普通成员
等级:3
金币:17.0
发贴:794
|
#22000/11/30 11:33:20
下面是滚动条的行为: property pchThumb -- 滑动块的通道号 n property pchScrollBar -- 滑动杆的通道号n-1 property pOnScreenField -- 视屏文字域的通道号 n-2 property pTotalHeight --文字域的实际总高度 property pThumbTop -- 滑动杆所能到的最高偏移值(pixel计算) property pThumbBottom -- 滑动杆所能到的最低偏移值(pixel计算) property pThumbRange -- 滑动杆所能移动范围(pixel计算)
on beginsprite me set pchThumb = me.spritenum set pchScrollBar =me.spritenum-1 set pOnScreenField = me.spritenum-2 set pTotalHeight=the height of the member of sprite pOnScreenField-the height of sprite pOnScreenField set pThumbTop = the top of sprite pchScrollBar + (the height of sprite pchThumb / 2) set pThumbBottom = the bottom of sprite pchScrollBar - (the height of sprite pchThumb / 2) set pThumbRange = pThumbBottom - pThumbTop end
on mouseenter me cursor 280 end
on mouseleave me cursor -1 end
on mousedown me repeat while the mouseDown set newMouseV = the mouseV if newMouseV >= pThumbBottom then set newMouseV = pThumbBottom else if newMouseV <= pThumbTop then set newMouseV = pThumbTop end if set deltaY=newMouseV-pThumbTop set the scrolltop of the member of sprite pOnScreenField=pTotalHeight*float(deltaY)/pThumbRange set the locV of sprite pchThumb = newMouseV updateStage end repeat end
--滚动条 --使用方法 --1、文本放在n-2号通道 -- 滑轴放在n-1号通道 -- 滑块放在n号通道 -- 上述三个精灵所在的通道必须连续, -- 如1,2,3或者10,11,12等。
--2、将"Scroll"行为直接拖到滑块精灵上即可
|
 toto
职务:版主
等级:5
金币:17.0
发贴:2582
|
#32000/11/30 11:46:06
谢谢!! 不过你的程序本菜鸟不太懂 我会试试的如果不行的话再向你请教了:)
|
 南山东篱摄螂
职务:普通成员
等级:4
金币:10.0
发贴:1840
|
#42000/11/30 23:31:22
关于这个,好像5D就有,我跟你说的那一篇我就是在5D下的,你到DR页去找找看!那是一个用面向对象的方法写的,出自莫特之手 由于不是我写的,我不好按它贴在论坛上!
|
 我是小马
职务:普通成员
等级:3
金币:17.0
发贴:794
|
#52000/12/3 13:38:14
虽然不是你写的,只要是好的就可以贴出来嘛(当然要征得作者的同意或者注明出处)
|