Question

I am using as3svgrendererlib to display svg file in flex at runtime.

I am using following code to do this.

ProcessExecutor.instance.initialize(stage);
var svg:SVGDocument = new SVGDocument();
svg.parse(re.result as String);
addChild(svg);

I am getting following error at runtime.

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]

Please suggest.

Was it helpful?

Solution

Got the solution.

Referred to this link here Stack Overflow Question

Now my code is like

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%"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top