Reputation: 918
I have a tree and I can arrange the nodes inside using drag and drop and my programs throws the null pointer exception. When I see the trace the error is actually in the core library and not on my code. do anyone know the meaning of this?
TypeError: Error #1009: null のオブジェクト参照のプロパティまたはメソッドにアクセスすることはできません。 at mx.controls.listClasses::ListBase/hideDropFeedback()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\listClasses\ListBase.as:8619] at mx.controls::Tree/dragDropHandler()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\Tree.as:3328] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128] at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:374] at mx.managers.dragClasses::DragProxy/mouseUpHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:599]
The exception happens when I start dragging a node (at least a pixel or two away). I have this initialization and after this I programatically add the children
eventsTree.dragEnabled=true; eventsTree.dropEnabled=true; eventsTree.dragMoveEnabled=true; eventsTree.addEventListener(ListEvent.ITEM_DOUBLE_CLICK, itemDoubleClickHandle eventsTree.addEventListener(DragEvent.DRAG_DROP, dragDropHandler); eventsTree.addEventListener(ListEvent.ITEM_CLICK,itemClickListener) loadTreeContents();
Upvotes: 0
Views: 403
Reputation: 683
An object that evaluates to null can have no properties. This error can occur in some unexpected (though valid) situations. For example, consider the following code, which creates a Sprite object. Since this Sprite object is never added to the display list (via the addChild() method of a DisplayObjectContainer object), then its stage property is set to null, and as such, its stage property cannot have any properties. So the code generates the errror: import flash.display.Sprite;
var sprite1:Sprite = new Sprite(); var q:String = sprite1.stage.quality;
There are two known fixes that I can suggest you try.
Perhaps re-arranging the code to this?
eventsTree.addEventListener(ListEvent.ITEM_DOUBLE_CLICK, itemDoubleClickHandle);
eventsTree.addEventListener(DragEvent.DRAG_DROP, dragDropHandler);
eventsTree.addEventListener(ListEvent.ITEM_CLICK,itemClickListener);
eventsTree.dragEnabled=true;
eventsTree.dropEnabled=true;
eventsTree.dragMoveEnabled=true;
loadTreeContents();
Hope this helps you.
P.S remember the semi-colons and to close the brackets.
References:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/runtimeErrors.html
Upvotes: 2