does anyone have any idea why this doesn't work?

passing in a displayObkectContainer (container) and the displayObject I want to rise to the top (objectToMove)
                
                        for (var i:int =0; i<container.numChildren; i++) {
                                if (container.getChildAt(i) == objectToMove) {
                                        index=i
                                        
                                }
                        }
                        if (index == container.numChildren) {
                                return //already at the top
                        } else {
container.swapChildren(container.getChildAt (index),container.getChildAt(container.numChildren-1))
        }

the odd thing is that I can get both container.getChildAt(index) and getChildAt(container.numchildren-1) but

I get an error on the swapchildren line saying that The supplied DisplayObject must be a child of the caller.

something odd going on ... suggestions appreciated


Matt

Reply via email to