ActionScript 3:在 Flash 嵌入中失去焦点时保持文本区域 UIscrollbar 位置
我正在使用 Flash CS4。当 CS4 编译后预览 swf 时,一切都正常运行。
但是,将 Flash 项目嵌入网页后,如果 textArea 在 Flash 片段中失去焦点,则 textArea 的内置 UIscrollbar 会重置到最顶部。
关键在于:如果我向 textArea 添加 FOCUS_OUT 事件侦听器来存储当前滚动条值,我发现即使在触发 FOCUS_OUT 事件之前,滚动条值也已重置为最小值!搞什么?
我认为发生这种情况是因为 textArea 的 htmlText 属性是动态填充的。 Adobe AIR 有处理 HTML 的高级方法,但不是简单的 AS3,哦不。多么令人讨厌啊。可以做什么?
I'm using Flash CS4. Everything functions as it should when CS4 previews the swf after compiling it.
However, after embedding the flash item in a webpage, if the textArea loses focus within the flash piece, the textarea's built-in UIscrollbar resets to the very top.
Here's the kicker: if I add a FOCUS_OUT event listener to the textArea to store the current scrollbar value, I find that the scrollbar value has been reset to minimum even before the FOCUS_OUT event is triggered! WTF?
I think this is occurring because the textArea's htmlText propery is dynamically populated. Adobe AIR has advanced methods for handing HTML, but not simple AS3, oh no. How obnoxious. What can be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从没想过我会回答我自己的问题,但它就是这样。事实证明 htmlText 的事情可能是谣言。滚动条抖动发生在动态生成的内容窗口被单击和失去焦点之间,因此这会捕获当前位置以及滚动条是否位于单击事件的底部,并将该信息传递给焦点事件。 displayWindow 是一个具有动态生成内容的窗口。
我对 AS3 比较陌生,所以如果其中有任何不合规矩的地方,请告诉我。
I never thought I'd answer my own question, but here it is. Turns out the htmlText thing may have been a canard. The scrollbar jitter happens in between the dynamically generated content window's being clicked and its losing focus, so this captures the current position and whether the scrollbar's at the bottom on the click event and passes that info to the focus event. displayWindow is the one with dynamically generated content.
I am relatively new to AS3, so let me know if any of this isn't kosher.