1、错误描述
TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::[email protected] 转换为 spark.core.IViewport。 at mx.binding::Binding/defaultDestFunc()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\binding\Binding.as:270] at Function/http://adobe.com/AS3/2006/builtin::call() at mx.binding::Binding/innerExecute()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\binding\Binding.as:475] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Binding/wrapFunctionCall()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\binding\Binding.as:385] at mx.binding::Binding/execute()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\binding\Binding.as:321] at mx.binding::BindingManager$/executeBindings()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\binding\BindingManager.as:153] at mx.core::UIComponent/executeBindings()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:10691] at mx.core::Container/createComponentFromDescriptor()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:4373] at mx.core::Container/createComponentsFromDescriptors()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:4160] at mx.core::Container/createChildren()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:3187] at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7250] at mx.core::Container/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:3129] at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7142] at mx.core::UIComponent/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6848] at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:1825] at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:1416] at spark.components::Group/setMXMLContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:512] at spark.components::Group/set mxmlContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Group.as:452] at spark.components::SkinnableContainer/set mxmlContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:604] at spark.components::SkinnableContainer/createDeferredContent()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:986] at spark.components::SkinnableContainer/createContentIfNeeded()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1014] at spark.components::SkinnableContainer/createChildren()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:827] at mx.core::UIComponent/initialize()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7250] at spark.components::Application/initialize()[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\Application.as:916] at Table/initialize() at mx.managers.systemClasses::ChildManager/childAdded()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:189] at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:341] at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2810] at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2637] at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2539] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.preloaders::Preloader/timerHandler()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515] at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()
2、错误原因
/** * 刷新按钮函数 */ protected function refresh_clickHandler(event:MouseEvent):void { var hx:Number = hsb.x; var hy:Number = hsb.y; //var dx:Number = dataGrid.contentMouseX; //var dy:Number = dataGrid.contentMouseY; //Alert.show("hx:"+hx+"\n"+"hy: "+hy + "\n" + "dx: " + dx + "\n" + "dy: " + dy); Alert.show("hx:"+hx+"\n"+"hy: "+hy); }
<s:HScrollBar id="hsb" width="100%" viewport="{dataGrid}"/>
类型转化异常
3、解决办法
时间: 2024-10-07 06:47:10