2009. február 17., kedd

Actionscript 3.0 - AimTarget

top_mc.buttonMode = true;
bottom_mc.buttonMode = true;
arrow_mc.buttonMode = true;

top_mc.addEventListener(MouseEvent.MOUSE_DOWN, addProp);
bottom_mc.addEventListener(MouseEvent.MOUSE_DOWN, addProp);
arrow_mc.addEventListener(MouseEvent.CLICK, goToTarget);

function addProp(event:MouseEvent):void
{
arrow_mc.aimTarget = event.target;
}

function goToTarget(event:MouseEvent):void
{
if (arrow_mc.aimTarget)
{
arrow_mc.x = arrow_mc.aimTarget.x;
arrow_mc.y = arrow_mc.aimTarget.y;
}
}

Nincsenek megjegyzések: