I do not see a click handler function in what you posted. Did I miss it?
No, wait, hold on, You can't use Application as the root tag for a component. I thought you said you were using canvas. Tracy Spratt, Lariat Services, development services available _____ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of timgerr Sent: Monday, May 18, 2009 11:40 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Getting an error when using a tree as a component OK, Here is what I did. I wanted to know if there was a problem with my code or was it the tree stuff. I went to Adobe Live Docs to get a tree example (http://livedocs. <http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.h tm?context=LiveDocs_Book_Parts&file=dragdrop_081_06.html> adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Book_Parts&file=dragdrop_081_06.html). I took this code and created a Canvas Component from it. I then created an app and called the code from it. I then called the app and when I click on any of the items in the tree I get this error: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/getChildIndex() at mx.managers::SystemManager/getChildIndex()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\managers\SystemManager.as:1652] at mx.managers::SystemManager/mouseDownHandler()[C:\autobuild\3.2.0\frameworks\ projects\framework\src\mx\managers\SystemManager.as:3439] Here is the code that I used for the component CallTree.mxml: [CODE] <?xml version="1.0"?> <!-- dragdrop\SimpleTreeSelf.mxml --> <mx:Application xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml> com/2006/mxml" width="700" height="250" borderStyle="solid"> <mx:Script> <![CDATA[ // Initialize the data provider for the Tree. private function initApp():void { firstList.dataProvider = treeDP; } ]]> </mx:Script> <mx:XML id="treeDP"> <node label="Mail"> <node label="Inbox"/> <node label="Personal Folder"> <node label="Demo"/> <node label="Personal"/> <node label="Saved Mail"/> <node label="bar"/> </node> <node label="Calendar"/> <node label="Sent"/> <node label="Trash"/> </node> </mx:XML> <mx:Tree id="firstList" height="200" width="200" showRoot="false" labelField="@label" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" allowMultipleSelection="true" creationComplete="initApp();"/> </mx:Application> [/CODE] Here is the application that is calling CallTree.mxml [CODE] <?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml> com/2006/mxml" width="700" height="250" borderStyle="solid" creationComplete="CallMeNow()"> <mx:Script> <![CDATA[ import com.callTree; public function CallMeNow():void { var t:callTree = new callTree() addChild(t); } ]]> </mx:Script> </mx:Application> [/CODE] I am not sure what to do here. Thanks for the read, timgerr