使用输入文本时如何改变字体的大小和粗细?闪存和 AS2
我已经使用 Flash CS5 和 AS2 完成了一个简单的联系表单。它们不是在每个文本字段外部包含“您的电子邮件”、“主题”和“消息”等标题,而是包含在每个相关文本字段内部,并且由输入文本。我想做两件事:
使初始文本(即“主题”)比用户输入的后续文本更小、更重。
我还希望用户开始在同一个框中键入内容后,初始文本(即“主题”)立即消失。
任何帮助将不胜感激。
I have completed a simple contact form using Flash CS5 and AS2. Instead of having headings such as "your email", "subject" and "message" outside each text field, they are contained inside each relevant text field and are made up of input text. I would like to do two things:
To have the initial text (ie. "Subject") in a smaller size and heavier weight than the subsequent text typed in by the user.
I would also like the initial text (ie. "Subject") to disappear as soon as the user starts to type in the same box.
Any help would be most appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用两个文本字段似乎不切实际。您可以使用文本字段的 onSetFocus 处理程序 并使用
setTextFormat()
和/或setNewTextFormat()
更改字体,text = "";
删除文本。其中 tf 是文本字段,format 是有效的 TextFormat 对象。
Using two text fields seems unpractical. You can use the onSetFocus handler of the textfield and use
setTextFormat()
and/orsetNewTextFormat()
to change the font, andtext = "";
to erase the text.where tf is the text field and format is a valid TextFormat object.
您是否希望用户能够与字段名称“默认”文本进行交互? (例如选择它,查看工字梁等)
如果没有,那么为什么不在输入 TextFields 后面有一个额外的动态 TextField,并带有您的字段名称,然后将其
_visible
设置为一旦用户开始输入,false
。Do you want the user to be able to interact with the field names "default" text? (e.g. to select it, to see the I-beam, etc)
If not, then why not just have an extra dynamic TextField behind the input TextFields, with your field names, and just set their
_visible
tofalse
once the user has started to type.