Adding custom component to viewstack at runtime

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?