Hola amigos del foro.
Tengo el siguiente error en una animación de colisiones, a ver si alguien me puede ayudar:
import com.coreyoneil.collision.CollisionList;
var messageBox:TextField = new TextField();
addChild(messageBox);
var target:Sprite = new Sprite();
addChild(target);
target.graphics.beginFill(0xFF0000);
target.graphics.drawCircle(0, 0, 80);
target.graphics.endFill();
target.graphics.beginFill(0x00AA00);
target.graphics.drawCircle(0, 0, 40);
target.graphics.endFill();
target.x = stage.stageWidth / 1.5;
target.y = stage.stageHeight / 2;
var collisionList:CollisionList = new CollisionList(target);
collisionList.excludeColor(0xFFFF0000);
for(var i:uint = 0; i < 4; i++)
{
var circle:Sprite = new Sprite();
circle.name = "circle " + i;
addChild(circle);
circle.graphics.beginFill(0x0000FF);
circle.graphics.drawCircle(0, 0, 20);
circle.graphics.endFill();
circle.x = 40;
circle.y = stage.stageHeight / 4 * i + 40;
circle.buttonMode = true;
circle.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown_Handler);
collisionList.addItem(circle);
}
function mouseDown_Handler(e:MouseEvent):void
{
var circle:Sprite = e.currentTarget as Sprite;
stage.addChild(circle);
e.currentTarget.startDrag();
e.currentTarget.addEventListener(MouseEvent.MOUSE_ MOVE, checkForCollision);
e.currentTarget.addEventListener(MouseEvent.MOUSE_ UP, mouseUp_Handler);
}
function mouseUp_Handler(e:MouseEvent):void
{
e.currentTarget.stopDrag();
e.currentTarget.removeEventListener(MouseEvent.MOU SE_MOVE, checkForCollision);
e.currentTarget.removeEventListener(MouseEvent.MOU SE_UP, mouseUp_Handler);
}
function checkForCollision(e:MouseEvent):void
{
var collisions:Array = collisionList.checkCollisions();
messageBox.text = "";
for(var i:uint = 0; i < collisions.length; i++)
{
var circle:Sprite = collisions[i].object1;
messageBox.appendText("Collision detected on " + circle.name + "\n");
messageBox.autoSize = "center";
messageBox.x = stage.stageWidth / 2 - messageBox.width / 2;
}
}
El error es el siguiente:
Escena 1, Capa 'Capa 1', Fotograma 1, Línea 1 1172: No se encontró la definición com.coreyoneil.collision:CollisionList.
De antemano muchas gracias.