| 自制滚动条 |
|
作者:Tomato 文章来源:闪吧 点击数: 更新时间:2005-5-15 11:17:00  |
|
這裡提供了進一步的滾動條教程給大家參考...滾動條其實不難做, 主要方法如下: 演示例子:
1. 建立一個動態文本(myText), 再來建立一個滾動條(scrollBar), 如圖: 2. 在幀上的控制代碼為 :
scrollBar.initial = function() { //定義滾動條的最高和最低位置 this.min = myText._y; this.max = this._y+(myText._height-this._height); inc = int(Math.abs(this.max-this.min)/myText.maxscroll); }; scrollBar.onPress = function() { //當滾動條被點下的時候 this.startDrag(false, this._x, this.min, this._x, this.max); //根據上方定義的變量賦予滾動條的拖拉範圍 this.onEnterFrame = function() { //拖拉時循環決定文本的滾動 myText.scroll = int(scrollBar._y/inc); }; }; scrollBar.onRelease = function() { //滾動條放開的時候 this.stopDrag(); //停止拖拉 delete this.onEnterFrame; //刪除循環以釋放資源的占用 }; scrollBar.initial(); //開始定義 就這樣而已... 很簡單吧... 如果有興趣的朋友可以進一步的增加功能
|
| 文章录入:admin 责任编辑:admin |
|
上一篇文章: 三星弹性导航菜单再探详解
下一篇文章: 较酷的导航按钮 |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |