At Last - Thank you very much Matt, this is all i was looking for .
 
some feedback - if you'll see the hole thread you see that some people suggested calling this property like this item.filterName
i think ActionScript is way too flexible (it doesn't throw an error) - so its easy to make mistakes .
 
besides the flexbuilder IDE should also support some REAL IntelliSense with AS code.
 
thanks
 
Shlomi
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt Chotin
Sent: Thursday, April 21, 2005 07:08
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How to populate tree control from web service re sult (server side java objects)

You should be able to do item.getProperty("filterName") and item.getProperty("categoryName") etc. and not have to use the backingObject directly.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 20, 2005 11:08 AM
To: 'flexcoders@yahoogroups.com'
Subject: RE: [flexcoders] How to populate tree control from web service re sult (server side java objects)

 

Jeff

 

I appreciate the response , but i think i didn't explain myself very well ,

I know i can implement the API , and i know i can write a method that loads the tree ,

BUT - there is an easy way to do this by assigning the result of the Web Service as the DataProvider of the Tree.

the only problem is that i found that you have to access an object called backingObject (macromedia internal)

and macromedia guys say there is more formal way doing this , which i failed to do .

 

in short here is the code. you can see the reference to this object if you remove it IT WON'T WORK.

 

<mx:script>

function myLabelFunc(item):String {
   var type=typeof item;
   
   if (item.backingObject.filterName == null){
    return item.backingObject.categoryName;
   }else{
    return item.backingObject.filterName + ", " + item.backingObject.filterGuid ;
   }
       }

</mx:script>

 

<mx:WebService id="UserCategoriesWS" result="onResult(event)" wsdl="@ContextRoot()/services/UserCategoriesWS?wsdl"
  showBusyCursor="true"
        fault="alert(event.fault.faultstring)">
        <mx:operation name="getUserFilterCategories">
    <mx:request>
         <userName>userName</userName>
     </mx:request>
  </mx:operation>
   </mx:WebService>

 

 

<mx:Tree id="filterTree" labelFunction="myLabelFunc" dataProvider="{UserCategoriesWS.getUserFilterCategories.result}" width="100%" height="100%" fontSize="10"/>

 

 

 

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Krueger
Sent: Wednesday, April 20, 2005 21:04
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How to populate tree control from web service re sult (server side java objects)

I think what you want to do is create a object that implements the TreeDataProviderAPI.  In this object it will be responsible for calling your webservice and get that data back and put it into AS objects.  Then create your tree.  At any given node you can have additional information.  So in the DATA part of each node stick your AS object.  Then when the user clicks on a node , you will have a AS object that represents your java object that you can do something with.  That being said I have tried to implement the TreeDataProviderAPI and was frustrated by it and the lack of documentation.  I was trying to create a lazy fetch tree control.  And trying to figure out the events, and the way everything is linked can be difficult

 

Jeff

 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


Yahoo! Groups Links

Reply via email to