调整影片剪辑的大小而不弄乱鼠标坐标

发布于 2024-08-02 19:42:05 字数 191 浏览 1 评论 0原文

我该怎么做?我有一个搜索栏,我正在对其进行改造以使用 FLVPlayback 调整大小。现在,当您单击搜索栏时,它会获取 mouseX,并将其除以搜索栏的长度,以便知道它应该搜索的百分比。

我的问题是,现在我动态设置搜索影片剪辑的宽度,宽度返回我设置的宽度,而鼠标事件返回位置,就好像它仍然是库中的原始宽度一样。

我该如何解决这个问题?

How do I do this? I have a seekbar which I'm retrofitting to resize with the FLVPlayback. Right now it gets the mouseX when you click the seekbar, and divides that by the length of the seekbar in order to know what percentage it should seek to.

My problem is that now that I'm dynamically setting the width of the seek movieclip the width returns the width I set, while the mouse event returns the position as if it was still the original width it has in the library.

How do I get around this problem?

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

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

发布评论

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

评论(2

娇女薄笑 2024-08-09 19:42:05

只需根据您的原始宽度进行缩放即可。假设您有一个 100 像素宽的栏,只需执行:

var seekTo:Number = seekbar.mouseX / 100;

无论搜索栏的当前宽度如何,这都会为您提供点击的百分比。

漂亮又简单,不需要时髦的坐标空间转换。

Just scale against the original width you had. Say that you've got a 100px wide bar, just go:

var seekTo:Number = seekbar.mouseX / 100;

This will give you the percentage clicked at regardless the current width of the seekbar.

Nice and easy and no funky coord space conversions needed.

最笨的告白 2024-08-09 19:42:05

MouseEvent 对象具有 stageX 和 stageY 属性 - 您只需将这些值偏移剪辑的位置即可设置。

The MouseEvent object has a stageX and stageY property - you just need to offset those values by the position of the clip and you should be set.

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