如何在ActionScript中正确移动和缩放?

时间:2009-12-05 00:51:39

标签: actionscript-3

function scale(e:Event):void{
    plane1_mc.scaleX += .1;
    plane1_mc.scaleY += .1;
    plane1_mc.x -= 5;
    plane1_mc.y -= 3;
}

function prop(evt:Event):void{
    plane1_mc.prop_mc.rotation += 100;
}

plane1_mc.prop_mc.addEventListener(Event.ENTER_FRAME, prop);
plane1_mc.addEventListener(Event.ENTER_FRAME, scale);

这就是我试图让plane1_mc进行缩放和移动的方法。它之前做过这两件事,但现在它只做了规模。任何人都可以随意告诉我

1 个答案:

答案 0 :(得分:0)

您的代码是正确的。尝试增加移动量并发布会发生的事情。像这样:

plane1_mc.x -= 50;
plane1_mc.y -= 30;

另外请确保您没有在其他地方缩放plane1_mc。可能会触发另一个事件而不是这个事件,所以看起来就像scaleX和scaleY值正在从这个函数中被修改而实际上没有。我建议在这个函数中加入一些跟踪语句,看看它们是否显示出来。