Actionscript 2.0 和 3.0:特定的“文本”在输入框中导致显示某些图像
我想知道如何(以及什么脚本)从文本输入框中获取单词并使其显示图像例如:如果文本框在其中显示“笑脸”,则图像“smiley_face.jpg”将显示在某个影片剪辑,可以在舞台上拖动,并且加载新图像时,它不会替换影片剪辑上的前一个图像。
I want to know how(and what scripts) to take words from a text input box and cause it to display and image Ex: if the text box said "smiley face" in it, then the image "smiley_face.jpg" would display on a certain movieclip and can be dragged around the stage and when a new image is loaded, it doesn't replace the previous image on the movie clip.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要监听 textInput 事件,并且您需要使用诸如 search() 函数(可以使用字符串或正则表达式)。
如果未找到您要搜索的字符串,则返回 -1,否则返回找到搜索字符串的第一个索引。
这是一个非常基本的示例:
您确实提到了笑脸,因此根据您对 ActionScript 3 的熟悉程度,可能还值得一看 Thibault Imbert 的 SmileyRenderer。请注意,它使用新的 FTE,因此您需要使用 Flash Player 10 等。
You need to listen for the textInput event and you need to constantly search for "smile" using something like the search() function(u can use strings or regular expressions).
It returns -1 if the string you're searching for wasn't found, otherwise it returns the first index where the searched string was found.
Here's a really basic example:
You did mention smileys, so depending on your level of comfort with actionscript 3, it might be also worth having a look at Thibault Imbert's SmileyRenderer. Careful it uses the new FTE so you need to use Flash Player 10, etc.
是的。在 ActionScript 中,您需要向文本字段添加侦听器事件。那么你可以做这样的事情。我的动作脚本不太好,所以我只会坚持逻辑。
您应该查看 lynda.com,了解他们的基本 AS 截屏视频
yeah. In ActionScript you need to add a listener event to the text field. then you can do something like this. My action script is not so good so I will just stick with logic.
You should check out lynda.com for their basic AS screencasts