Flex 3 : UIComponent.addChild issue
Posted
by Frank
on Stack Overflow
See other posts from Stack Overflow
or by Frank
Published on 2010-03-19T14:58:14Z
Indexed on
2010/03/19
15:01 UTC
Read the original article
Hit count: 685
Hello SOers, I've run into a nice problem with the UIComponent.addChild(...) function.
First of all, I'm using ESRI Api for Flex. In this API you find a class called Graphic that inherits UIComponent. Basically, I'm trying to add, as a child, a Graphic 'g' to another graphic 'parent'. So that when you delete the 'parent' graphic the 'g' graphic deletes as well.
private function writeMeasurements(parent:Graphic):void
{
var g:Graphic;
if(parent.geometry.extent != null)
g = new Graphic(parent.geometry.extent.center);
else
g = new Graphic(parent.geometry);
g.initialize();
g.name = UIDUtil.createUID();
g.symbol = txtSym;
graphicsLayer.add(g);
parent.addChild(g);
}
This code actually runs pretty fine. The problem is after... it's like if the addChild function was asynchronious.
This is the error I get :
TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
at com.esri.ags::Graphic/updateDisplayList()[C:\checkout\flex_api\api\src\com\esri\ags\Graphic.as:346]
at mx.core::UIComponent/validateDisplayList()
at mx.managers::LayoutManager/validateDisplayList()
at mx.managers::LayoutManager/doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()
at mx.core::UIComponent/callLaterDispatcher()
I know this is a very specific question, but I think you guys are the BEST!
Thanks.
© Stack Overflow or respective owner