带有精灵和矩形的滚动条不会移动文本,只会移动它所绘制的矩形

发布于 2024-08-24 12:30:37 字数 895 浏览 8 评论 0原文

警告:学校作业。

对于那些仍然和我在一起的人,我的任务是在 Flash 中制作一些可滚动的内容。使用 LoadURL() 加载 TextFile,然后显示它。为了获取文本,我们编写了自己的类 TextFieldExtended,它基本上只是将文本文件位置提供给构造函数,然后让该类执行获取它并为您加载它的各个步骤。

所以我需要一个滚动条,我在这里得到的: http://kirupa.com /forum/showthread.php?t=245468

(在本文末尾链接的 zip 中的所有文件)

问题是,它适用于 Sprites。 在尝试让它接受 TextFieldExtend 后,我遇到了一个障碍,因为滚动条严重依赖于 TextFieldExtended 没有或可能有的 Sprite 属性。

因此,我尝试使用 addchild 将 TextFieldExtended 实例添加到 Sprite 实例。 这里出现一个问题,我不知道如何处理。似乎绘制了一个矩形,并在其上绘制了文本。我这样说是因为滚动条将矩形上下移动一点,但文本不会滚动,只是滚动它所在的矩形,然后文本随之移动。

我的问题:这个问题可以解决吗?或者滚动条的实现是否需要进行大量调整才能实现?

如果是这样,您可以推荐任何滚动条,因为此时它对我来说太长了。

所有文件:http://www.mediafire.com/?q2ium22gmox 这是使用 ActionScript3 在 Flash CS4 中制作的。 Example 类是最终的实现

Warning: school assignment.

For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.

So I needed to get a Scrollbar, which I got here: http://kirupa.com/forum/showthread.php?t=245468

(all files in a zip linked at the end of this text)

The thing is, it works with Sprites.
After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.

So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.
A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.

My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?

If so, any scrollbars you can recommend, because it's too extended for me at this point.

All files: http://www.mediafire.com/?q2ium22gmox
This was made in Flash CS4 using ActionScript3. The Example class is the final implementation

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

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

发布评论

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

评论(1

意中人 2024-08-31 12:30:37

听起来像是一个奇怪的问题;我读到你说你将 TextField 放入 Sprite 中时,我想“他只需将该 TextField 放入 Sprite 中”,所以我不太确定如何解决你遇到的具体问题。我猜这是你正在使用的滚动条。因此,这是另一个使用起来相当简单的方法:

http://www.warmforestflash.com/blog/2009/04/free-as3-scrollbar-fullscreen-and-ressized/

尝试一下。根据我的经验,滚动条可能很繁琐,但这只是找到适合您的实现的问题。希望有帮助。

Sounds like an odd problem; I was reading up to the point where you say you put your TextField in a Sprite thinking "he just needs to put that TextField in a Sprite", so I'm not quite sure how to fix the specific problem you've got. I'd guess it's the Scrollbar you're using. So here's another one that's fairly straightforward to use:

http://www.warmforestflash.com/blog/2009/04/free-as3-scrollbar-fullscreen-and-resizable/

Give that a whirl. Scrollbars can be fiddly in my experience, but it's just a matter of finding an implementation that suits you. Hope it helps.

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