This content has been marked as final. Show 2 replies
If you run in debug mode instead of just the regular run mode, it will give
you line numbers. But it looked like you tried to call a method on a text
control that only exists on a container, or you passed a text control as an
argument to something that needs a container.
"wallanceM" <firstname.lastname@example.org> wrote in message
> Can someone help me understand where the error is? I don't understand how
> read the errors that the debugger outputs.
> TypeError: Error #1034: Type Coercion failed: cannot convert
> mx.controls::Text@2f07ccf1 to mx.core.Container.
> at mx.controls::NavBar/_setTargetViewStack()
> at mx.controls::NavBar/checkPendingTargetStack()
> at mx.controls::NavBar/commitProperties()
> at mx.controls::ButtonBar/commitProperties()
> at mx.controls::ToggleButtonBar/commitProperties()
> at mx.core::UIComponent/validateProperties()
> at mx.managers::LayoutManager/validateClient()
> at mx.core::UIComponent/validateNow()
> at mx.core::UIComponent/creationCompleteHandler()
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at mx.core::UIComponent/dispatchEvent()
> at mx.core::UIComponent/set initialized()
> at mx.managers::LayoutManager/doPhasedInstantiation()
> at Function/ http://adobe.com/AS3/2006/builtin::apply()
> at mx.core::UIComponent/callLaterDispatcher2()
> at mx.core::UIComponent/callLaterDispatcher()
Usually this happens when you try to change the view of a ViewStack, such as:
var myText:Text = new Text();
myText.text = "productCatalog";
myViewStack.selectedChild = myText;
The ViewStack wants a container for selectedChild, but you are passing a Text object. It doesn't matter that the value of the Text object text property (productCatalog) might be the same as the name of a container object within the ViewStack.
The following code illustrates the problem, with a slightly different error, and provides one solution: