AS 3简单易用 [英] AS 3 simple ease

查看:86
本文介绍了AS 3简单易用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何移动对象并在移动时能看到它?不仅会消失并出现在其他位置,就像使用以下代码一样.

How can I move an object and be able to physically see it when it is moving? Not just disappear and appear on a different location like it would be using the following code.

buttonL2_btn.addEventListener(MouseEvent.CLICK,左);

buttonL2_btn.addEventListener(MouseEvent.CLICK, left);

左功能(event:Event):void {

function left(event:Event):void{

      box_mc.x =241.5;
}

这会将myObject移动到指定的任何位置,但是我再次希望在移动时能够看到它.

This is going to move myObject to any location specified, but again I want to be able to see it when moving.

推荐答案

在您的示例中,您只是在按下某个按钮,需要将X更改为EnterFrame事件时将其设置为X位置,例如:

In your example you are just setting it's X position when some button is pressed, when you need to change X into an EnterFrame event, like this:

this.addEventListener(Event.ENTER_FRAME, move);

function move(event:Event):void{
      box_mc.x -= 5
}

您的box_mc应该与您的帧速率相应地向左移动5个像素.

Your box_mc should move left 5 pixels accordingly with your framerate.

您可以轻松地使用缓动库.我强烈建议 TweenMax .

You can use a easing library to that easily. I strongly recommend TweenMax.

这篇关于AS 3简单易用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆