Hi again.

I have the following sequence of code:

if (this.parent.getChildIndex(this) < this.parent.numChildren-1) {
  trace(this.parent+" should swap the following items:")
  trace(this+" on level "+this.parent.getChildIndex(this))
  trace(this.parent.getChildAt(this.parent.numChildren-1)+" on level    
           "+(this.parent.numChildren-1))
  try {
    this.parent.swapChildren(this, 
        this.parent.getChildAt(int(this.parent.numChildren-1))
    );
  }
  catch (e:*) {
    trace(e)
  }
}

and it's output from the console window:

FloatingWidgetContainer135.FloatingFrontView138.WidgetMainView198.Canvas248
should swap the following items:
FloatingWidgetContainer135.FloatingFrontView138.WidgetMainView198.Canvas248.thumbnail280
on level 1
FloatingWidgetContainer135.FloatingFrontView138.WidgetMainView198.Canvas248.thumbnail409
on level 2
ArgumentError: Error #2025: The supplied DisplayObject must be a child
of the caller.


The above code is called inside the mouse_Down listener for a custom
thumbnail. The thumbnail is located inside a canvas and more instances
of the thumbnail are added programatically when needed. The user has
the option to drag and drop the thumbnail (this are thumbnails of
uploaded pictures) and I need to swap them because the dragged object
is shown below some of the thumbnails (for example, if I have 2
thumbs, and I drag the first one, it will be displayed below the
second one, because of their corresponding depths. Each thumbnail
creates the floating, draggable image as it's own child).

One option would be to create the draggable item in the same canvas
with the other thumbnails, but that might raise some issues related to
the position of the draggable picture.

Any ideas on this (I hope i'm not being too ambiguous)
Thanks.

Reply via email to