Skip to main content
Inspiring
March 22, 2013
Answered

Drag and Drop Error1010 part of the time?

  • March 22, 2013
  • 1 reply
  • 2694 views

I have a drag and drop game that uses arrays for targets.  I have a property on the array of "allowed" so that I can have 4 target "zones". 

However, I had a problem in the sense that I kept getting a 1010 error due to using the allowed property (if I dropped the mc on the outside of the target, it was likely I would see a 1010 error). 

I figured out that I needed to add my "allowed" property to all of my other movieclips, and it works for the most part.  However, it appears that if I drop my movieclips on the border of another movieclip, I get a 1010 error. 

I've applied my "allowed" property to everything I could find, event "root" (due to some images that were also causing the 1010 error) and this keeps happening.

Any ideas?

This topic has been closed for replies.
Correct answer kglad

so each target has an allowed property that is the array of allowed dropped movieclips?  if so, that should cause no problem.  in your drop listener function:

function dropF(e:MouseEvent):void{

if(MovieClip(e.currentTarget).dropTarget.allowed){

if(MovieClip(e.currentTarget).dropTarget.allowed.indexOf(e.currentTarget)>-1){

// this is allowed dropped target

} else {

// wrong target

} else {

// not dropped on any target

}

}

1 reply

kglad
Community Expert
Community Expert
March 22, 2013

i don't see any need for an allowed property, at all. 

generally, there are allowed drop targets (listed in an array is good).  when an object is dropped, a hittest is performed with the allowed dropped targets and if any are positive you do one thing and if they are all negative, you do another.

Inspiring
March 22, 2013

The reason I have the property assigned is because I have 16 movieclips, and 16 targets broken which are broken into 4 zones (4 movieclips per zone).  I didn't want the order of the movieclips in each zone to be required, so I assigned the allowed property to each target as an array that referenced the 4 allowable movieclips in that target.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
March 22, 2013

so each target has an allowed property that is the array of allowed dropped movieclips?  if so, that should cause no problem.  in your drop listener function:

function dropF(e:MouseEvent):void{

if(MovieClip(e.currentTarget).dropTarget.allowed){

if(MovieClip(e.currentTarget).dropTarget.allowed.indexOf(e.currentTarget)>-1){

// this is allowed dropped target

} else {

// wrong target

} else {

// not dropped on any target

}

}