码迷,mamicode.com
首页 > 其他好文 > 详细

TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::DataGrid@9a7c0a1 转换为 spark.core.IViewport。

时间:2014-10-19 18:41:58      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:flex

1、错误描述

TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::DataGrid@9aa90a1 转换为 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、解决办法

TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::DataGrid@9a7c0a1 转换为 spark.core.IViewport。

标签:flex

原文地址:http://blog.csdn.net/you23hai45/article/details/40264157

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!