Steps to reproduce:
1. Create two canvas bigger and smaller inside it.
2. Call addChild on bigger canvas with reference to smaller one as a method parameter
3. Close error alert
Actual Results:
Throws error:
RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
at mx.core::Container/getChildAt()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2332]
at mx.containers.utilityClasses::CanvasLayout/updateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\utilityClasses\CanvasLayout.as:279]
at mx.containers::Canvas/updateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\containers\Canvas.as:363]
at mx.core::UIComponent/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6214]
at mx.core::Container/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2675]
at mx.managers::LayoutManager/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:602]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:675]
at Function/
http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]
at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]
Expected Results:
Should swap smaller canvas on the top of all children.
Workaround (if any):
Check if child exists and remove it before adding again.