![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
Can someone help me understand where the error is? I don't understand how to
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/dispatchEventFunctio n() 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() |
| Sponsored Links |
|
|||
|
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. HTH; Amy "wallanceM" <webforumsuser@macromedia.com> wrote in message news:ggsshc$av6$1@forums.macromedia.com... > Can someone help me understand where the error is? I don't understand how > to > 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/dispatchEventFunctio n() > 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: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.controls.Text; private var myText:Text = new Text(); private function init():void{ myText.text = "view3"; } private function clickHandler():void{ // Uncomment this line and comment out the line // after that to see the error: //myViewStack.selectedChild = myText.text; myViewStack.selectedChild = this[myText.text]; } ]]> </mx:Script> <mx:LinkBar dataProvider="{myViewStack}"/> <mx:ViewStack id="myViewStack"> <mx:VBox id="view1" label="View1"> <mx:Label text="View 1" fontSize="20"/> </mx:VBox> <mx:VBox id="view2" label="View2"> <mx:Label text="View 2" fontSize="20"/> </mx:VBox> <mx:VBox id="view3" label="View3"> <mx:Label text="View 3" fontSize="20"/> </mx:VBox> </mx:ViewStack> <mx:Button label="Select View 3" fontSize="15" click="clickHandler()"/> </mx:Application> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise