ActionScript3 导出问题

发布于 2024-11-15 00:50:38 字数 634 浏览 10 评论 0原文

我刚刚开始使用动作脚本三,我编写了代码来使影片剪辑可以通过击键移动,并编写 HitTest 来运行另一个影片剪辑。当我预览它时,一切正常。但是当我将其发布为 html 时,击键停止工作。其他动画工作正常,只是动作似乎根本没有导出。我该怎么办?

这是代码:

boat1_mc.x = 10
boat1_mc.x = 10
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyPressed);

function keyPressed(event:KeyboardEvent) :void

{
    switch(event.keyCode)
    {
        case Keyboard.RIGHT: boat1_mc.x += 5
        break;
        case Keyboard.LEFT: boat1_mc.x -= 5
        break;

        default :
        break;
    }
    if(boat1_mc.hitTestObject(tree_mc))
{
    tree_mc.gotoAndPlay(2);
    boat1_mc.x = 10
    boat1_mc.x = 10

}
}

感谢您的帮助!

I have just started using actionscript three and I wrote code to make a movieclip moveable through keystrokes and a HitTest to make another movie clip run. When I preview it it all works fine. But when I publish it to html the key strokes stop working. The other animations are working fine, just the actions seem to be not exporting at all. What do I dooo?

Here is the code:

boat1_mc.x = 10
boat1_mc.x = 10
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyPressed);

function keyPressed(event:KeyboardEvent) :void

{
    switch(event.keyCode)
    {
        case Keyboard.RIGHT: boat1_mc.x += 5
        break;
        case Keyboard.LEFT: boat1_mc.x -= 5
        break;

        default :
        break;
    }
    if(boat1_mc.hitTestObject(tree_mc))
{
    tree_mc.gotoAndPlay(2);
    boat1_mc.x = 10
    boat1_mc.x = 10

}
}

Thanks for the help!

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

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

发布评论

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

评论(1

菊凝晚露 2024-11-22 00:50:38

这可能太简单了,但是您是否单击了 swf 使其获得焦点?当您第一次加载页面时,按键会转到页面本身;您需要在 swf 中单击才能通过按键到达那里。

This may be too simple, but did you click in the swf to give it focus? When you first load the page keypresses go to the page itself; you need to click in the swf for keypresses to go there.

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