public class dragitem1 extends MovieClip
{
protected var dropTarget1Full:Number = 0;
protected var dropTarget2Full:Number = 0;
protected var dropTarget3Full:Number = 0;
protected var dropTarget4Full:Number = 0;
protected var dropTarget5Full:Number = 0;
protected var dropTarget6Full:Number = 0;
protected var originalPosition:Point;
public function dragitem1()
{
originalPosition = new Point(x,y);
buttonMode = true;
addEventListener(MouseEvent.MOUSE_DOWN, down);
}
protected function down(event:MouseEvent):void
{
startDrag();
parent.addChild(this);
protected function returntoOriginalPosition():void
{
x = originalPosition.x;
y = originalPosition.y;
}
}
}
02-20-2012, 03:51 PM
5TonsOfFlax
Did you have a question?
Why are you using Numbers as booleans? Why does your class not start with a capital letter? Why are you putting it in the com package? This class is also tightly coupled with the structure of the droptargets and the BinMC. You should not be matching using names, and you should be setting the valid targets from outside this class. You have a copy and paste error in the dropTarget6 case where you are checking dropTarget5Full again. If you set the targets from outside and put them in an array, you wouldn't have to repeat your code 6 times, and you could use an arbitrary number of targets.