hey guys. im pretty new to actionscript 3.
im trying to make a basic addition game where two random numbers are generated, and then the sum of the numbers will be dragged/snapped into place underneath.
i thought the easiest way to drag/snap the “total” number would be to somehow turn it into a button that still allowed dynamic text.
here is my code so far
var high:Number = 5;
var low:Number = 1;
var firstNumber:Number = Math.floor(Math.random()*(1+high-low))+low;
var secondNumber:Number = Math.floor(Math.random()*(1+high-low))+low;
var total:Number = firstNumber + secondNumber;
var mc:MovieClip=new MovieClip()
firstNumber_box.text = String(firstNumber)
secondNumber_box.text = String(secondNumber)
total_box.text = String(total)
addChild(mc)
mc.addChild(total_box)
mc.addEventListener(MouseEvent.MOUSE_DOWN,drag)
mc.addEventListener(MouseEvent.MOUSE_UP,drop)
function drag(event:MouseEvent)
{
event.currentTarget.startDrag();
}
function drop(event:MouseEvent)
{
stopDrag();
}
any help would be really appreciated, if you guy’s could explain what the code does as well, that would be awesome!