下拉条是制作FLASH课件时经常会用到的组件,但是对于不怎么会代码的同学,制作这样的效果就比较难了。在这里讲使用UIScrollBar组件结合动态文本框实现文字内容下拉效果的方法。
打开制作软件,新建AS3文档。
打开组件面板,快捷键(Ctrl+F7)。
找到UIScrollBar组件,用鼠标拖到舞台上。
在舞台添加一个动态文本框,大小可设置如下,并使用任意变形工作对刚才拖出来的组件进行大小调整,如下。
动态文本框属性设置如下。
下拉条组件属性设置如下。
选择下拉条组件,并在属性面板点击显示参数。设置scrollTargetName为txt
主时间轴加如下代码:
txt.text="asdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfaasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nsdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\nasdfasdfasdfasdfasdfasdf\n";
其中\n是换行标识符。导出效果如下
标签:FLASH,下拉条,AS3