trun/flashblocks — Issue #2: Error when connecting to older sibling
Author: trun
Created: 2012-01-07 05:25:23+00:00
State: open

When dropping a block on an older sibling port that is already connected to a different parent the following error occurs...

```
ArgumentError: Error #2024: An object cannot be added as a child of itself.
at flash.display::DisplayObjectContainer/addChildAt()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$addChildAt()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5094]
at mx.core::Container/addChildAt()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\Container.as:2258]
at mx.core::Container/addChild()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\Container.as:2183]
at com.flashblocks.blocks::CommandBlock/connectOlderSibling()[G:\Projects\flashblocks\src\com\flashblocks\blocks\CommandBlock.as:34]
at com.flashblocks::Page/tryConnection()[G:\Projects\flashblocks\src\com\flashblocks\Page.as:121]
at com.flashblocks::Page/tryConnection()[G:\Projects\flashblocks\src\com\flashblocks\Page.as:140]
at com.flashblocks::Page/tryConnection()[G:\Projects\flashblocks\src\com\flashblocks\Page.as:146]
at com.flashblocks::Page/addBlock()[G:\Projects\flashblocks\src\com\flashblocks\Page.as:50]
at com.flashblocks::BlockDragLayer/onBlockDragComplete()[G:\Projects\flashblocks\src\com\flashblocks\BlockDragLayer.as:135]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440]
at com.flashblocks::Workspace/rebroadcastEvent()[G:\Projects\flashblocks\src\com\flashblocks\Workspace.as:267]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440]
at com.flashblocks.blocks::SimpleBlock/onMouseUp()[G:\Projects\flashblocks\src\com\flashblocks\blocks\SimpleBlock.as:154]
```

A simple example...

```
CONTROL:
FUNC_A
FUNC_B
```
Drop `FUNC_A` such that...

```
CONTROL:
// pass
FUNC_A
FUNC_B
```

...and the bottom port of `FUNC_A` connects to the older port of `FUNC_B`.