Other folks have complained about the XML to object conversion.  Start
adding trace statements to see if your data is coming over correctly.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of sk_acura
Sent: Monday, March 24, 2008 3:44 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Unable to view the TreeNode after adding the
ArrayCollection Elements..

 

Hi All,

When i run this as a Standalone application the tree is getting
displayed..

The same code worked in Flex 2 , Flex 3 Beta versions and now i
switched the Flex SDK to (flex_sdk_3.0.0.477) and all of a sudden the
Tree won't show up and no errors in any of the logs !!

Regards
Mars

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "sk_acura" <[EMAIL PROTECTED]> wrote:
>
> Hi All,
> 
> I have a simple code where the Tree Elements are being added using
> the ArrayCollection as the dataProvider.
> 
> I don't see any Errors but i don't see the Tree as well !!
> 
> I am using BlazeDS and Java Code on the sever side..
> 
> Here is my Code..(init() is being called in createComplete)
> [CODE]
> <mx:VBox width="40%" height="100%">
> <mx:Tree id="collectionTree"
> labelFunction="treeLabel"
> dataProvider="{domainArrayCollection}"
> selectionColor="#ffff33"
> showRoot="true"
> backgroundColor="#ffffff"
> width="100%" height="100%"
> change="getNodeInfo(event)"
> textSelectedColor="#ff3333">
> </mx:Tree>
> </mx:VBox>
> 
> private function init():void{
> trace("Here in init()");
> modelNavigator = new RemoteObject("MyCollectionNavigatorFacade");
> getCollections();
> trace("Here after getCollections()");
>
this.addEventListener(FocusViewEvent.EVENT_FOCUS_WINDOW,this.onFocusWind
ow);
> trace("After adding the Event Listener 1");
>
MyEventDispatcher.getInstance().addEventListener(FocusViewEvent.EVENT_FO
CUS_WINDOW,this.onFocusWindow);
> trace("After adding the Event Listener 2");
> }
> 
> public function getCollections():void{
> trace("Here in getCollections()");
> if(modelNavigator!=null){
> var at:AsyncToken=modelNavigator.getCollectionNodes();
> at.addResponder(new ItemResponder(displayCollectoions, faultHandler));
> }
> else{
> Alert.show("Unable to communicate with the modelNavigator @@@@");
> }
> }
> 
> private function displayCollectoions(resultObj:Object,
> token:Object=null):void {
> 
> this.domainArrayCollection = new ArrayCollection();
> this.collectionsList = resultObj.result as ArrayCollection;
> if(collectionsList!=null && collectionsList.length>0){
> for(var j:int=0;j<collectionsList.length;j++){
> var obj:Object = this.collectionsList.getItemAt(j);
> trace(" Object Type ="+obj);
> var modelNode:Node = Node (obj);
> domainArrayCollection.addItem(modelNode);
> }
> trace("No.of Elements in the domainArrayCollection
> ="+domainArrayCollection.length);
> }
> else{
> Alert.show("No Collections Exists!!!!");
> }
> }
> 
> public function treeLabel( item:Object ) : String
> {
> var node:Node = null;
> node = Node(item);
> //trace(" Here in treeLabel and Node ="+node.className);
> return node.nodeLabel;
> }
> [/CODE]
> Here is my trace output
> [OUTPUT]
> Here in init()
> Here in getCollections()
> Here after getCollections()
> After adding the Event Listener 1
> After adding the Event Listener 2
> Here in displayCollectoions & resultObj.result =[object Node],[object
> Node]
> Object Type =[object Node]
> Element Type =[object Node]
> Node =1234 childElements =2
> Object Type =[object Node]
> Element Type =[object Node]
> Node =2234 childElements =2
> No.of Elements in the domainArrayCollection =2
> [/OUTPUT]
> 
> I am not sure why the tree is not showing up..
>

 

Reply via email to