网页监测滚动条脚本_Flash脚本-在Flash中创建动态滚动条

网页监测滚动条脚本

Download the sample files here.

在此处下载示例文件

1. Open a new movie, and assign it a width of 200 and a height of 150.

1.打开新电影,并为其分配200的宽度和150的高度。

2. Create a rectangle with a width of 150 and height of 550.

2.创建一个宽度为150高度为550的矩形。

3. Create a small rectangle for the scroller. Mine has a width of 16 and a height of 35.

3.为滚动条创建一个小矩形。 矿山的宽度为16,高度为35。

4. Now convert the larger rectangle to a movie clip, and give it an instance name of "bar".

4.现在将较大的矩形转换为影片剪辑,并为其指定实例名称“ bar”。

5. Convert the scroller to a button. Select the scroller, press f8, and convert it to a movieclip.

5.将滚动条转换为按钮。 选择滚动条,按f8键,然后将其转换为动画片段。

6. Give the scroller an instance name of "scroll".

6.为滚动器指定实例名称“ scroll”。

7. Now, go into the timeline of the scroller movieclip. Right click the button, and select "actions". Insert the actions below:

7.现在,进入滚动影片剪辑的时间轴。 右键单击按钮,然后选择“操作”。 插入以下操作:

on (press)
{
//left=180 right=180 top=10 bottom=100
startDrag ("/scroll", false, 180, 10, 180, 100);
_root.flag = true;
}
on (release)  
{
stopDrag ();
}

8. Next, go back to the main timeline. Go to menu insert > new symbol > movieclip, and give it the name "code".

8.接下来,返回主时间轴。 转到菜单插入>新符号> movieclip,并将其命名为“代码”。

9. Drag the code movieclip from the library to the stage, and go into its timeline.

9.将代码movieclip从库中拖到舞台上,并进入其时间轴。

10. Create two blank key frames. In the first key frame, insert the following actions:

10.创建两个空白关键帧。 在第一个关键帧中,插入以下操作:

if(_root.flag)
{
vtop = 12;
scroll_length = 110;
bar_length = getProperty("/bar", _height);
incr = bar_length/scroll_length;
scroll_y = vtop - getProperty("/scroll", _y);
y_pos = scroll_y * incr;
y_pos = y_pos + vtop;
setProperty ( "/bar", _y, y_pos );
}
if(!_root.flag)
{
setProperty ( "/bar", _y, 20);
}

11. In the second key frame, insert: gotoAndPlay (1);

11.在第二个关键帧中,插入: gotoAndPlay (1);

12. Now go back to the main timeline. Select the "bar" movieclip and go to its timeline.

12.现在回到主时间轴。 选择“ bar”动画片段,然后转到其时间轴。

13. Position the object so that the center point of the object is at the top. To do this, select the object, press shift, and use the down arrow.

13.放置对象,以使对象的中心点在顶部。 为此,选择对象,按shift,然后使用向下箭头。

That’s all it takes! Test the movie.

这就是全部! 测试电影。

翻译自: https://www.sitepoint.com/dynamic-scroller-flash/

网页监测滚动条脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值