开发者

How to create Textfield with scroll in AS3 and FlashDevelop?

I am working on a flash开发者_运维问答 game based on an AS3 project using FlashDevelop.

I need a textbox with scroll bar.

I was able to create an editable TextField, but I can't find a way to add

a vertical scroll bar.

Thanks,

SW.


The Flash runtime doesn't provide any native UI controls (button, scrollbar, combobox, etc) so you must either use or write components developed in AS3.

Adobe Flash Professional includes a set of UI components; the Flex framework offers many (and heavyweight) components but you must go Flex from the ground up. Both have serious pros and cons but at least their code is interesting to study.

You'll find plenty of (often bad) scrollbar scripts around the web - this is a good exercice to learn Flash.

Please note that you have 2 ways of scrolling text:

  • TextFields have a scroll property to scroll text line by line,
  • or set a mask (or better a scrollRect) to scroll arbitrary contents including a long TextField.


if you add flex_sdk_4.1\frameworks\libs\framework.swc to SWC libraries (at project properties -> compiler options) you may import and use mx.controls.VScrollBar


You're going to have to develop one yourself, or find a free solution online. It will generally involved a very high textfield that's revealed only partly due to a mask. The scroll bar then controls the Y position of the textfield, so the mask reveals different parts of the textfield.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜