# Adding custom component to viewstack at runtime

**URL:** <https://forum.kirupa.com/t/adding-custom-component-to-viewstack-at-runtime/274991>\
**Category:** Uncategorized\
**Created:** [November 7, 2008, 12:28pm UTC](https://forum.kirupa.com/t/adding-custom-component-to-viewstack-at-runtime/274991 "2008-11-07T12:28:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shubs6](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@shubs6](https://forum.kirupa.com/u/shubs6)\
**Post date:** [November 7, 2008, 12:28pm UTC](https://forum.kirupa.com/t/adding-custom-component-to-viewstack-at-runtime/274991/1 "2008-11-07T12:28:34Z")

</div>

I’m creating a viewstack having 2 canvases in its two tabs (using LinkBar for navigation). On the first tab, I add a custom component to the canvas component at the latter’s creation complete event using addchild() method. The second tab has a single button only in its UI.  
Now my problem is that whenever I click on the second tab of the viewstack I get the runtime error “2025 The supplied DisplayObject must be a child of the caller.”

Can someone help me?
