我正在使用as3svgrendererlib在运行时在flex中显示svg文件。
我正在使用以下代码来执行此操作。
ProcessExecutor.instance.initialize(stage);
var svg:SVGDocument = new SVGDocument();
svg.parse(re.result as String);
addChild(svg);
我在运行时遇到以下错误。
TypeError: Error #1034: Type Coercion failed: cannot convert com.lorentz.SVG.display::SVGDocument@110fdeb9 to mx.core.IUIComponent.
at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:3259]
at mx.core::Container/addChildAt()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2207]
at mx.core::Container/addChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2140]
at mpt.project::GanttChartPopUP/createGanttChartResultHandler()[G:\MPT\MPT_Current_Code\CUB\MPTToolKit_UI\src\mpt\project\GanttChartPopUP.mxml:64]
at mpt.project::GanttChartPopUP/___GanttChartPopUP_Operation1_result()[G:\MPT\MPT_Current_Code\CUB\MPTToolKit_UI\src\mpt\project\GanttChartPopUP.mxml:74]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:198]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at NetConnectionMessageResponder/resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:515]
at mx.messaging::MessageResponder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199]
请建议。
答案 0 :(得分:0)
得到了解决方案。
此处提到此链接Stack Overflow Question
现在我的代码就像
ProcessExecutor.instance.initialize(stage);
var svg:SVGDocument = new SVGDocument();
svg.parse(re.result as String);
uic.addChild(svg);
<mx:UIComponent id="uic" width="100%" height="100%"/>