这很难解释。
我的目标是每次单击时根据鼠标的 X/Y 轴放置绵羊(符号)...。我希望它生成绵羊的副本但我也希望每个副本都是不同的图像..(每次单击鼠标时,它都会更改绵羊符号内的图像(放置在不同的框架上)。
如果有人可以提供帮助,我将非常感激!
这是代码:
stage.addEventListener (MouseEvent.CLICK, makeABox);
var i:Number = 1;
function makeABox(e:Event):void {
var newSheep:myMC = new myMC();
addChild(newSheep);
newSheep.x = stage.mouseX;
newSheep.y = stage.mouseY;
i++;
}
var numPressed:Number = 0;
stage.addEventListener(MouseEvent.CLICK, countUp);
function countUp(evt:MouseEvent):void {
numPressed++;
if (numPressed == 1) {
sheep.gotoAndPlay(1);
}
else if (numPressed == 2) {
sheep.gotoAndPlay(2);
}
else if (numPressed == 3) {
sheep.gotoAndPlay(3);
}
else if (numPressed == 4) {
sheep.gotoAndPlay(4);
}
else if (numPressed == 5) {
sheep.gotoAndPlay(5);
}
else if (numPressed == 6) {
sheep.gotoAndPlay(6);
}
else if (numPressed == 7) {
sheep.gotoAndPlay(7);
}
if(numPressed >= 7) numPressed = 0;
}