Makesure mainWindow is the right parent.
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of guillaumeracine Sent: Saturday, June 14, 2008 10:40 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Error #2025: The supplied DisplayObject must be a child of the caller Hi i made a slideshow component. For example their is a main Canvas (mainCanvas) that contains 3 nested canvas (canvas1,canvas2,canvas3). All 4 canvas have the same size dans completely overlaps each other. When the user click to see a previous Canvas i call this code: mainWindow.swapChildren( canvas2,canvas1 ); To make the previous Canvas (canvas1) visible. Ok all works fine if my component is directly nested in a mx:application tag. But in a real world application, i need to nest it in some hierachy of Canvas. This is where i get this error message when calling the swapChidren method : IllegalArgument Error #2025: The supplied DisplayObject must be a child of the caller. I really don't understand why because when i trace canvas2.parent and canvas1.parent, mainCanvas is returned... So the following mxml code works for swapChildren: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " details ommited...> <comp:HomeSlideShow id="slideShow" y="0" width="610" height="200" dataProvider="{slideShowProvider}" verticalScrollPolicy="off" horizontalScrollPolicy="off" borderStyle="solid" borderThickness="1" borderColor="#000000" horizontalCenter="0" /> <mx:Application/> BUT NOT THIS ONE: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " details ommited...> <mx:Canvas details ommitted...> <mx:Canvas details ommited...> <mx:Image source="assets/accueil/slideshow/slideshowHeader_fr.jpg"/> <comp:HomeSlideShow id="slideShow" y="0" width="610" height="200" dataProvider="{slideShowProvider}" verticalScrollPolicy="off" horizontalScrollPolicy="off" borderStyle="solid" borderThickness="1" borderColor="#000000" horizontalCenter="0" /> </mx:Canvas> </mx:Canvas> <mx:Application/>