Question
complicated drap and drop
Hello, I am trying to do something with my drag and drop game
that is too complicated for me to find on any tutorial.
I am trying to set it up so that when the item is being dragged and it is over the correct drop area, the item blinks (which I have animated on the 2nd frame and beyond in each item). The problem is, I can't seem to run a hitTest while the item is being dragged, or onPress of the item. I have even tried to set an interval so that my indicator function runs every 50 milliseconds. I have included the sample script below, if anyone could help me it would be greatly appreciated.
//------//var intervalId:Number
function indicator(item,labels){
if(eval(item).target_mc.hitTest(eval(labels).target_mc)){
eval(item).gotoAndStop(2);
}}
//-------//intervalId = setInterval(indicator, 50);
function labelsTest(item,labels){
eval(item).stopDrag();
if(eval(item).target_mc.hitTest(eval(labels).target_mc)){
eval(labels).gotoAndStop(2);
eval(item).enabled=false;
eval(item)._visible=false;
counter++;
if (counter==7){gotoAndStop("continue");
}
}}
item1_mc.onPress = function () {
item1_mc.startDrag();
item1_mc.swapDepths(this.getNextHighestDepth());
indicator("item1_mc","label1_mc");
}
item1_mc.onRelease = function () {
labelsTest("item1_mc","label1_mc");
}
I am trying to set it up so that when the item is being dragged and it is over the correct drop area, the item blinks (which I have animated on the 2nd frame and beyond in each item). The problem is, I can't seem to run a hitTest while the item is being dragged, or onPress of the item. I have even tried to set an interval so that my indicator function runs every 50 milliseconds. I have included the sample script below, if anyone could help me it would be greatly appreciated.
//------//var intervalId:Number
function indicator(item,labels){
if(eval(item).target_mc.hitTest(eval(labels).target_mc)){
eval(item).gotoAndStop(2);
}}
//-------//intervalId = setInterval(indicator, 50);
function labelsTest(item,labels){
eval(item).stopDrag();
if(eval(item).target_mc.hitTest(eval(labels).target_mc)){
eval(labels).gotoAndStop(2);
eval(item).enabled=false;
eval(item)._visible=false;
counter++;
if (counter==7){gotoAndStop("continue");
}
}}
item1_mc.onPress = function () {
item1_mc.startDrag();
item1_mc.swapDepths(this.getNextHighestDepth());
indicator("item1_mc","label1_mc");
}
item1_mc.onRelease = function () {
labelsTest("item1_mc","label1_mc");
}