我可以访问 Flex 中 textArea 中的 htmlText setter 代码吗?
问候, 我可以看到,当我在 textarea 控件中设置 htmlText 时,text 属性包含文本的 html 免费版本。所以有一个解析器从内容中提取 html,这对我的目的非常有用。 不过基于flex源码,html的设置是在UITextField.as中完成的,是TextArea的textfield成员的类型。完成这项工作的线路是: super.htmlText = 值; 在功能上 override public function set htmlText(value:String):void
尝试遵循类层次结构,我最终得到了 FlexTextField 类,它扩展了 flash 播放器的文本字段类。
看来我所追求的功能是在 Flash 播放器中。那么有什么方法可以访问这个html清理功能呢?我在这里错过了什么吗?
此致 塞雷夫
Greetings,
I can see that when I set htmlText in a textarea control, the text property contains the html free version of the text. So there is a parser somewhere that is ripping of html from the content, which would be very usefull for my purposes.
However, based on the flex source code, the setting of html is done in UITextField.as, which is the type of the textfield member of TextArea. The line that does the work is:
super.htmlText = value;
in function
override public function set htmlText(value:String):void
Trying to follow the class hieararchy, I end up in FlexTextField class, which extends flash player's textfield class.
It appears the functionality I am after is in flash player. So is there any way of accessing this html cleaning function? Am I missing something here?
Best Regards
Seref
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不可以,无法访问 Flash Player 本机类中的代码。
但是,您应该能够使用正则表达式轻松解析内容中的所有 HTML 标签。
虽然未经测试,但这里有一个选项出现在谷歌中。您可以在 Flex 中使用它。所以,你也许可以这样做:
当然,这是在浏览器中编写的。 有关 Flex 中的正则表达式的详细信息。
Nope, there is no way to access code in the Flash Player native classes.
However, you should be able to use a Regex to easily parse out all HTML Tags in your content.
Although, not tested, here is one option that came up in Google. You can just use that in Flex. So, you can probably do something like this:
Of course, this was written in the browser. More info on Regex in Flex.
如果正则表达式失败,您可能需要检查以下内容:
PS:我尚未测试此 ActionScript 代码,这里是我测试并发现有效的等效 JavaScript 代码。我认为它可以在 ActionScript 中工作,因为两者都遵循 ECMAScript。
输出:
In case regex fails you, here is something you might want to check out:
PS: I haven't tested this ActionScript code, here is the equivalent JavaScript code that I tested and found working. I assume it would work in ActionScript since both follow ECMAScript.
output: