Flash CS4:如何在单击按钮时播放影片剪辑

发布于 2024-11-08 16:11:57 字数 323 浏览 4 评论 0原文

我想在单击按钮时播放影片剪辑。

我做了 3 种状态:

inicial (how it looks before anything happens) (up)
hover (plays an animation after waiting 20 frames) (over)
click (plays an animation right away) (down)

我将这些影片剪辑放置在按钮的向上、向上和向下帧内。这非常有效,除了当我单击时,我需要单击并按住动画才能通过第一帧。

我该怎么做才能单击按钮并完整播放影片剪辑?

I want to play a movie clip when I click a button.

I made 3 states:

inicial (how it looks before anything happens) (up)
hover (plays an animation after waiting 20 frames) (over)
click (plays an animation right away) (down)

I placed these movie clips inside of my button's up, over, and down frames. This works great except when I click, i'll need to click and hold for my animation to get past the first frame.

What can I do so that I click on my button and plays the movie clip in its entirety?

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

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

发布评论

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

评论(1

筱武穆 2024-11-15 16:11:57

假设您在 IDE 中创建一个按钮:
由于按钮“按下”状态仅在其实际“按下”时注册,因此您需要在按下鼠标时触发的按钮外部关联一个影片剪辑。

someButton.addEventListener(MouseEvent.MOUSE_DOWN, runClip);

private function runClip(e:MouseEvent):void
{
    _downClip.play();
}

您需要准确定位它,或者将其包裹在另一个符号中。

...

或者更好的是,在 AS3 中对整个事情进行编程并摆脱时间线开发...

更新 -

我没有任何首选的教程或网站,特别是。但只需谷歌搜索“as3 按钮教程”,您应该会得到很多点击... 这个 看起来相当完整。

哦,等等 - 我想我发布了一个基本图像按钮的类,可以轻松更改该按钮以与库中的影片剪辑一起使用...是的,它是正确的 此处。如果您有 as3/面向对象编程的经验,基本思想应该相当清晰。如果不是 - 谷歌离开;)

干杯

Assuming you're creating a button in the IDE:
Because the button "down" state is only registered while its actually "down", you'd need to associate a movieclip outside of the button that is triggered on mouse down.

someButton.addEventListener(MouseEvent.MOUSE_DOWN, runClip);

private function runClip(e:MouseEvent):void
{
    _downClip.play();
}

You'd need to position it accurately, or wrap it up in another symbol.

...

Or better yet, program the whole thing in AS3 and get away from timeline development...

update -

I don't have any preferred tutorials or sites for this, in particular. But just google "as3 button tutorial" and you should get a lot of hits... this one looks pretty complete.

Oh, wait - I think I posted a class for a basic image button that could be easily altered to function with movieclips from the library... yep, its right here. The basic idea should be fairly clear if you have any experience with as3 / object oriented programming. And if its not - google away ;)

Cheers

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