删除Flash动画中的“口吃”

时间:2011-10-21 22:28:38

标签: flash actionscript

我注意到在ActionScript中编写一个简单的动作(例如object.x + = 5)时,当按住键盘键以引起动作时,会在动作的外观中创建一个断续。有没有办法删除它或使它看起来更流畅?

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyDown);
someMC.addEventListener(Event.ENTER_FRAME, enterFrameUpdate);
var isADown:Boolean = false;

function keyDown(e:KeyboardEvent){
   if(e.keyCode == Keyboard.A){
       isADown = true;
   }
}

function keyUP(e:KeyboardEvent){
   if(e.keyCode == Keyboard.A){
       isADown = false;
   }
}

function enterFrameUpdate(e:Event){
    if(isADown){
         myMovieClip.x -= 3;
    }
}

进口是:

flash.events.KeyboardEvent;
flash.events.Event;
flash.ui.Keyboard;
//and a few more

如果swf仍然是生涩(但是均匀)运动,也会增加swf的FPS。单击舞台的空白部分(主屏幕),然后单击CTRL-F3或属性屏幕,您应该能够在那里更改FPS。