主题:  请教一个移动的问题

skylord

职务:普通成员
等级:1
金币:0.0
发贴:41
#12002/8/28 9:23:41
我学flash 没有多久 有个简单的问题 请哪位告诉我如何用ac控制mc移动 (平滑移动)
最好是贴出代码



IT编辑

职务:普通成员
等级:6
金币:10.0
发贴:7769
#22002/8/28 11:26:05
//当键被按下后执行下面的语句
onClipEvent (keyDown) {    
//如果击键为'→'键就执行下面的语句
  if (Key.getCode() == Key.LEFT) {
//把影片宽度附值给变量width
width = getProperty(mc, _width);    
movex = getProperty(mc, _x);
  if(movex<= 0){
    movex = width/10;
  }
//以影片宽度的十分之一作为图片移动的单位值
  setProperty (mc, _x, movex-width/10);
}
if (Key.getCode() == Key.RIGHT) {
width = getProperty(mc,_width);
movex = getProperty(mc,_x);    
  if(movex >= 360-width){            
    movex = 360-width-width/10;
  }    
  setProperty (mc, _x, movex + width/10);
    
}
  if (Key.getCode() == Key.UP) {    
 height = getProperty(mc, _height);    
  movey = getProperty(mc, _y);
    if(movey <= 0){            
    movey = height/10;
    }
setProperty (mc, _y, movey-height/10);
}
if (Key.getCode() == Key.DOWN) {    
height = getProperty(mc,_height);    
movey = getProperty(mc, _y);    
  if(movey >= 160- height){            
  movey = 160 - height- height/10;
  }
  setProperty (mc, _y, movey + height/10);
}
}



瀚叔

职务:普通成员
等级:1
金币:1.0
发贴:256
#32002/8/28 23:57:15
简单例子:原文件:

相关文件:点这儿打开