用纯AS写滚动条
作者 佚名技术
来源 服务器技术
浏览
发布时间 2012-07-08
色"]); var sanjiaohuodongse = jinzhizhuanhuan(attributes["活动色"]); //记录下原始色和活动色,以备在“上”,“下”按钮中使用 jiluyuanshise = attributes["原始色"]; jiluhuodongse = attributes["活动色"]; var sanjiaotoumingdou = attributes["透明度"]; } //滑块参数 with (jiedianlujing_xml[3]) { var huakuaibeijingse = jinzhizhuanhuan(attributes["背景色"]); var huakuaitoumingdu = attributes["背景透明度"]; var huakuaibiankuangse = jinzhizhuanhuan(attributes["边框色"]); var huakuaibiankuangtoumingdou = attributes["边框透明度"]; var huakuaibiankuangcuxi = attributes["边框粗细"]; } //先根据文本域的高确定滚动条的高 gundongtiaogao = wenben_txt._height; ////////////中心法绘制滚动条背景矩形条 createEmptyMovieClip("gundongtiao_mc", 1000); gundongtiao_mc.beginFill(gundongtiaobeijingse, gundongtiaotoumingdu); gundongtiao_mc.zhongxinjuxing(0, 0, gundongtiaokuan, gundongtiaogao, gundongtiaobiankuangcuxi, gundongtiaobiankuangse, gundongtiaobiankuangtoumingdou); gundongtiao_mc.endFill(); //根据文本域的位置确定滚动条位置,使其紧贴在文本域的右端 gundongtiao_mc.dingwei(wenben_txt._x+wenben_txt._width+gundongtiao_mc._width/2, wenben_txt._y+wenben_txt._height/2); /////////中心点矩形法绘制滚动条上下按钮 //////绘制上按钮背景方块 gundongtiao_mc.createEmptyMovieClip("shangfangkuai_mc", 1); gundongtiao_mc.shangfangkuai_mc.beginFill(fangkuaibeijingse, fangkuaitoumingdu); gundongtiao_mc.shangfangkuai_mc.zhongxinjuxing(0, 0, gundongtiao_mc._width, gundongtiao_mc._width, fangkuaibiankuangcuxi, fangkuaibiankuangse, fangkuaitoumingdu); gundongtiao_mc.shangfangkuai_mc.endFill(); //定位上按钮背景方块 gundongtiao_mc.shangfangkuai_mc.dingwei(0, -gundongtiao_mc._height/2+gundongtiao_mc.shangfangkuai_mc._height/2); //////绘制上按钮三角形 gundongtiao_mc.createEmptyMovieClip("shangsanjiao_mc", 2); //中心点法绘制三角形 //首先定义一个因子,此因子等于正三角形中心到各顶点的距离,用来定位三角形各顶点的位置。 var yinzi = gundongtiaokuan/3; var zuobiao1x = -1/2*Math.pow(3, 1/2)*yinzi; var zuobiao1y = 1/2*yinzi; var zuobiao2x = 1/2*Math.pow(3, 1/2)*yinzi; var zuobiao2y = 1/2*yinzi; var zuobiao3x = 0; var zuobiao3y = -yinzi; var zuobiao1 = {x:zuobiao1x, y:zuobiao1y}; var zuobiao2 = {x:zuobiao2x, y:zuobiao2y}; var zuobiao3 = {x:zuobiao3x, y:zuobiao3y}; gundongtiao_mc.shangsanjiao_mc.beginFill(sanjiaoyuanshise, sanjiaotoumingdou); gundongtiao_mc.shangsanjiao_mc.sanjiaoxing(zuobiao1, zuobiao2, zuobiao3, 1, 0x000000, 0); gundongtiao_mc.shangsanjiao_mc.endFill(); //定位上三角形 gundongtiao_mc.shangsanjiao_mc.dingwei(0, -gundongtiao_mc._height/2+gundongtiao_mc.shangfangkuai_mc._height/2); //////复制上按钮背景方块和三角形,并定位于下方 //复制下方块 gundongtiao_mc.shangfangkuai_mc.duplicateMovieClip("xiafangkuai_mc", 3); //定位下按钮背景方块,这里的Y坐标加一,是为了让下方块跟文本框底部对齐! gundongtiao_mc.xiafangkuai_mc.dingwei(0, Math.floor(gundongtiao_mc._height/2-gundongtiao_mc.xiafangkuai_mc._height/2)+1); //复制下三角形 gundongtiao_mc.shangsanjiao_mc.duplicateMovieClip("xiasanjiao_mc", 4); //旋转180度 gu |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于用纯AS写滚动条的所有评论