I’m stuck. I’m trying to make a movieclip (techHeavy) to appear on the screen, and then I want to be able to click on a position to make the movieclip move to that position.
But I can’t, flash keeps giving me the error: “1126: Function does not have a body.”, and even though this seems fairly straightforward I have no idea what to do. I’ve tried browsing the forums but since I haven’t found anything I posted this here, the cose is as follows:
package
{
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
{
public class Dystopian extends Sprite
{
var aRightMedium:Object; //creates an object/variable
var aRightHeavy:Object;
var aTechHeavy:Object;
public function Dystopian();
{
var targetX:Number = 0;
var targetY:Number = 0;
var Move:Boolean = false;
aTechHeavy = new techHeavy();
aRightHeavy = new rightHeavy();
aRightMedium = new rightMedium();
aTechHeavy.x = 200; //location
aTechHeavy.y = 200;
addChild(aTechHeavy);
stage.addEventListener(MouseEvent.CLICK, placeActiveTank) //moves the movieclip to where I clicked the mouse
}
private function placeActiveTank(event:Event):void; //The function that is called when I click the mouse
{
if(Move) //if Move == true, move the movieclip to where I clicked the mouse, also initiate the mc:s own animation
{
aTechHeavy.x = aTechHeavy.x + (targetX - aTechHeavy.x) /10
aTechHeavy.y = aTechHeavy.y + (targetY - aTechHeavy.y) /10
aTechHeavy.nextFrame(); //start animation
}
if (!Move)
{
aTechHeavy.gotoAndPlay(1);
}
if (aTechHeavy.hitTestPoint(targetX, targetY, true))
{
Move = false
}
}
}
}
}