如何仅引用 TextArea 的 htmlText 块的一部分?

发布于 2024-08-17 00:19:08 字数 248 浏览 10 评论 0原文

我有许多质量很差的 pdf 文档,看起来像 80 年代的复印件,我正在 Flash(Flex Builder 3 MXML 应用程序)中重建它们,在 TextAreas 中表示文本段落,以便所选部分可以是粗体或斜体,或其他我需要。我需要一种方法将工具提示或事件侦听器应用于文本块中的各个单词,以将这些单词链接到词汇表。我非常高兴创建一个定义面板,该面板通过鼠标悬停填充并可见,但不知道如何仅对文本的一部分执行此操作。

有没有一个好的/干净的/简单的方法来做到这一点?

I have a number of very poor-quality pdf documents that look like 80's photocopies, which I'm rebuilding in Flash (Flex Builder 3 MXML application), representing paragraphs of text in TextAreas so that selected portions can be bold or italic, or whatever I need. I need a way to apply toolTips or event listeners to individual words within the block of text to link those words to a glossary. I'm perfectly happy to create a definition panel that is populated and made visible with a mouseOver, but don't know how to do it to just a portion of the text.

Is there a good / clean / easy way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

莳間冲淡了誓言ζ 2024-08-24 00:19:08

我还没有在 AS3 中尝试过这一点,但是在 AS2 中我必须做类似的事情,方法是使用多个 TextFormat(),这几乎是一场噩梦。在某一时刻,我必须重新定义将重新绘制的字符串并重新将它们置于上下文中(字符数不同),以便它们可以突出显示或加粗等。我不推荐这种方法。从好的方面来说,CSS 在 Flex 中相当“原生”,因此我建议研究使用这些样式元素重新定义文本片段的选项。老实说,我越多地使用 Flex 中的内置文本函数,我就越想直接编写 HTML/CSS/JS 代码并使用 SWFobject。 YMMV。

I haven't tried this out in AS3 yet, but the way in which I had to do similar things in AS2 was to use multiple TextFormat()s, which is pretty much a nightmare. At one point I had to redefine the strings that would be redrawn and re-contextualize them (number of characters were different) so that they could be highlighted or bold'd etc. I would not recommend this method. On the brighter side, CSS is fairly "native" in Flex, so I would recommend looking into options for redefining your text pieces w/r/t those styled elements. To be honest, the more I use the built in functions for text in Flex, the more I want to just code straight HTML/CSS/JS instead and use SWFobject instead. YMMV.

软的没边 2024-08-24 00:19:08

如果我理解正确,您的主要问题是为 textArea 中文本的不同部分提供不同的工具提示。

与这个问题非常接近的问题在这里得到了回答(没有仔细看,但看起来像:)): Flex:监听文本区域中链接上的“悬停”

唯一的区别是文本区域中带有成对字符串位置的数组 - < code>tootl 提示文本,当用户将鼠标悬停在文本区域上时,函数会计算用户滑过的位置,并在数组中查找足够的工具提示。

希望它能有点帮助:)

If I understand correctly, your main problem is to have different tooltip for different parts of text in textArea.

Question very close to this one was answered here (Haven't looked very closely, but looks like:) ): Flex: Listening for 'Hover' over Link in text area

The only difference would be some array with pairs of string position in text area - tootl tip text and while user MOUSE_OVER the textArea, function counts what position is user over and looks up in array for adequate tooltip.

Hope it helps a bit :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文