I could be wrong, but I believe that swapChildren is not supported in
Flex Container.  Neither is re-parenting.
 
I would use PopUpManager to float the draggable image.  You can call
removeChild to remove from the container before handing to popupmanager.
 
You might also want to build the whole thing by subclassing UIComponent.

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flashcrow2000
Sent: Monday, September 03, 2007 5:13 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] swapchildren error: The supplied DisplayObject
must be a child of the caller



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.Canvas
248
should swap the following items:
FloatingWidgetContainer135.FloatingFrontView138.WidgetMainView198.Canvas
248.thumbnail280
on level 1
FloatingWidgetContainer135.FloatingFrontView138.WidgetMainView198.Canvas
248.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