[flexcoders] TIF to JPEG Converter Using ActionScript

2007-04-18 Thread Hari Kolasani
Since the ImageViewer control doesn't handle the TIF foramt, We are 
thinking about using server side conversion using Sun's JIMI.

But, we are not sure if that is going to be a performance bottleneck in 
a multi-user environment (J2EE App on the server side doing the 
conversion using JIMI).

Has anyone come across a client side TIF to JPEG converter that is based 
on ActionScript?

Regards
Hari Kolasani





[flexcoders] TIF to JPEG Converter Using ActionScript

2007-04-18 Thread Hari Kolasani
Since the ImageViewer control doesn't handle the TIF foramt, We are
thinking about using server side conversion using Sun's JIMI.

But, we are not sure if that is going to be a performance bottleneck
in a multi-user environment (J2EE App on the server side doing the
conversion using JIMI).

Has anyone come across a client side TIF to JPEG converter that is
based on ActionScript?

Regards
Hari Kolasani






Re: [flexcoders] Re: HTTPService (jsp, specifically) getting cached?

2006-10-16 Thread Hari Kolasani
I had the same issue and my work around was to change the browser option
in IE :
Internet Options--General Tab --Temporary Internet Files -- Settings
Select the Radio Button 'Every visit to the page' under Check for newer 
visit to the page

Hari Kolasani
Integranium, Inc.

Doug Lowder wrote:
 
 
 You can prevent caching by putting the following into your jsp:
 
 response.setHeader(Cache-Control, max-age=0, must-revalidate);
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com, 
 djbrown_rotonews
 [EMAIL PROTECTED] wrote:
  
   I've run into a situation where I want to re-issue a call to a jsp via
   an HTTPService with the same set of parameters. (It's a query to a db
   essentially, with the params specifying the WHERE clause of the SQL).
   The problem comes when I try and re-issue the HTTPService with the
   same parameters in that the jsp does NOT get called, and I simply get
   a cached result from the previous HTTPService call.
  
   Is there a way to cache/uncache these results so I don't have to add a
   guaranteed unique dummy variable as a parameter (currently using a
   timestamp as a workaround?
  
 
 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 



[flexcoders] FileUpload on HTTPService (Flex 2.0)

2006-10-10 Thread Hari Kolasani
I have a form with a few text fields and a field for File. (I am 
thinking about using FileReference.Browse and let the user select a file).

When the submit button is clicked, I want to send a HTTPService request 
with the form fields as parms. Is there anyway to upload a file along 
with the form parameters ? I looked at the FileReference upload , but 
that's for uploading an individual file. What I am looking for is 
similar to the traditional HTML form that can submit a file.

- Hari


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] Dynamic DataGrid selectedItem

2006-10-08 Thread Hari Kolasani
Hello,

I have a Dynamic DataGrid (I create DataGrid columns dynamically based 
on the query Results from back-end.).

Once the datagrid is populated and a row is selected , I can get the 
selectedItem as an object and I can see the values of the columns (in 
FLex Builder debugger).

But, is there any  to retrieve the column values using a dynamic column 
name.

For e.g something like

var colName:String = Customer;

mydatagrid.selectedItem.getColumnValue(colName)

Insted of mydatagrid.selectedItem.Customer



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Dynamic DataGrid selectedItem

2006-10-08 Thread Hari Kolasani
Never Mind. I posted it too soon. I just figured a way to do this:

  var:selectedRow = mydatagrid.selectedItems[0];

  for (var colName:String in selectedRow ) {
   var colVal = selectedRow[colName]);
   }


Hari Kolasani wrote:
 
 
 Hello,
 
 I have a Dynamic DataGrid (I create DataGrid columns dynamically based
 on the query Results from back-end.).
 
 Once the datagrid is populated and a row is selected , I can get the
 selectedItem as an object and I can see the values of the columns (in
 FLex Builder debugger).
 
 But, is there any to retrieve the column values using a dynamic column
 name.
 
 For e.g something like
 
 var colName:String = Customer;
 
 mydatagrid.selectedItem.getColumnValue(colName)
 
 Insted of mydatagrid.selectedItem.Customer
 
 


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] accessing from custom component

2006-06-24 Thread Hari Kolasani
arnold_charming wrote:

 Hi!

 I have a main.mxml file. This file holds inself a viewstack. One
 viewstack is filled with a custom component (login.mxml). The question
 now is, how can I access a text field (mx:Text) which is in
 main.mxml from login.mxml. Tnx.

  
You can use something like this.ParentApplication.myTextFieldId.


 Yahoo! Groups Sponsor ~-- 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] When is Flex 2 Generally Available ??

2006-03-09 Thread Hari Kolasani






Does anyone know when Flex 2 is going to be generally available. We
are working with a client trying to build an online enterprise
reporting application and Flex with Charting seems to be a good choice.
The project needs to go live in June/July time frame. I am trying to
find out what the risk levels are if we start developing the app. now
using the Beta with an assumption that Flex 2 is going to be available
by this Summer.








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  










Re: [flexcoders] Re: Full dynamic tree example

2006-02-27 Thread Hari Kolasani






Here is a sample .mxml/as code that worked for me. Hope this will
help.

- Hari

*
?xml version="1.0" encoding="utf-8"?
mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"
backgroundColor="#FF" creationComplete="initList()"
 mx:Script
  ![CDATA[
  import mx.collections.XMLListCollection;
  
  var origXML:XML;

  public function initList() 
  {
   myTree.rootVisible = false;

   //TODO: Get this XML from a data service
   var origXMLString:String = "MyRoot " + 
   "node1
label=\"supernode1\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
   "node2
label=\"supernode2\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
   "node3
label=\"supernode3\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
  "/MyRoot";
   
   origXML = new XML(origXMLString);
   myTree.dataProvider = origXML;
  }
  public function open(event:Object)
  {
   var selectedNode:Object =event.node;
   
   var myXMLList:XMLList = new XMLList(selectedNode);
   
   //TODO: Get this XML from a data service
based on the selected node.
   var newXMLString:String = "childnode1
label=\"childnode1\" someProp=\"sdsdf \" isBranch=\"true\" /" + 
 "childnode2
label=\"childnode2\" someProp=\"sdsdf \" isBranch=\"false\" /" + 
  "childnode3
label=\"childnode3\" someProp=\"sdsdf \" isBranch=\"true\" /" ; 
   
   var myNewXMLList:XMLList = new XMLList(newXMLString);
   
   selectedNode.setChildren(myNewXMLList);
   
   myText1.text = selectedNode.toXMLString();
   myText2.text = myTree.dataProvider.source[0];
   myTree.dataProvider = origXML;
  }
  
  public function close(event:Object)
  {
   var selectedNode:Object = event.node;
   
   var myXMLList:XMLList = new XMLList(selectedNode);
   
   removeAllDecendants(myXMLList);
   
   myText1.text = selectedNode.toXMLString();
   myText2.text = myTree.dataProvider.source[0];
   myTree.dataProvider = origXML;
  }
  
  public function removeAllDecendants(xmlList:XMLList)
  {
   var myDescendantXMLList:XMLList = xmlList.descendants();
   var myDecendentXMLListCollection:XMLListCollection = new
XMLListCollection(myDescendantXMLList);
   myDecendentXMLListCollection.removeAll();
  }

 ]]
 /mx:Script

 !-- Simple example to demonstrate the Tree control --
 mx:XML id="myxml"
 /mx:XML

 mx:HDividedBox width="100%" height="100%"

 !-- Tree listing of directories (only) --
 mx:Box
mx:Tree id="myTree" width="600" height="600"
labelField="@label" defaultLeafIcon="@Embed('images/folder.gif')"
nodeOpen="open(event)" nodeClose="close(event)"/
 /mx:Box

  mx:VBox
  !-- Text Areas to Display Node XMLs --
  mx:Box
   mx:TextArea width="600" height="300" id="myText1"
/
  /mx:Box
 mx:Box
   mx:TextArea width="600" height="300" id="myText2"
/
  /mx:Box
 /mx:VBox
 /mx:HDividedBox
/mx:Application
*

Brendan Meutzner wrote:

It doesn't work for 2.0
  
  
Brendan
  
--- In flexcoders@yahoogroups.com, "Pat Buchanan" [EMAIL PROTECTED]
wrote:

 Brendan - thank you so much for the additional information. I'm
sure it
 will prove helpful. Do you know if this FAST architecture is
compatible with
 Flex 2?
 
 However, if anyone out there happens to run into a self contained,
fully
 running simple example (with source) please pass along the URL. If
I can
 finally get one running, I will post the source here.
 
 It would be greatly appreciated.
 
 Oh - and Flex 2 is the target, of course. :)
 
 Thank you!
 -Pat Buchanan
 
 
 
 On 2/24/06, Brendan Meutzner [EMAIL PROTECTED] wrote:
 
  Pat,
 
  Have a look at the object inspector tool in the FAST
toolkit...
 
  http://www.macromedia.com/devnet/flex/articles/fast_userguide.html
 
  Pay attention to:
 
  EchoConsole.mxml
  EchoConsoleconnection.as
  EchoAppConnection.as
 
  You'll have to figure out your remote calls, but this does
show the
  dynamic construction of a tree dataProvider might help...
 
 
  Brendan
 
 
 
  --- In flexcoders@yahoogroups.com, "Pat Buchanan"
ajillis@ wrote:
  
   Hello fellow Flex coders! Greetings from the frozen
state of Utah.
  
   Well, I'm stuck. I see a lot of people asking for
examples of how
  to do a
   dynamic tree. Dynamic as in JUST loading the first
level of nodes,
  and when
   the user opens a node, it calls back to the server, gets
it's
  children, and
   adds them to the tree dynamically.
  
   (The reason I can't load the tree all at once is because
it can be
   recursive, so the tree would go forever.)
  
   Anyway, I have searched the list archive and I see a LOT
of
answers with
   either a quick explanation or tiny partial code snippet,
but
have yet to
   find a COMPLETE running example. Every time I find what
I'm looking
  for via
   Google, it links back to a certain pay site and I can't
justify $250
  for a
   few lines of example code.
  
   Does anyone know of a fully working dynamic tree example
with
source?
  
   I'm POSITIVE it's right under my 

[flexcoders] Opening a Word Document in a Flex Container

2006-02-17 Thread Hari Kolasani






I am not sure if this is even feasible. Is there a way to open
Microsoft office documents like Word and Excel in a Flex Panel ?






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  










[flexcoders] Dynamic DataGridColumns

2006-02-14 Thread Hari Kolasani






Flexcoders,

Is there any way to assign the DataGridColumns dynamically? 

Instead of hardcoding each of the DataGridColumn, I would like to
dynamically create an Array of them using the 'mydata' ArrayCollection.

-
var mydata:ArrayCollection = new
ArrayCollection(myservice.result.data.row);

mx:DataGrid id="zndg" width="100%" height="100%"
dataProvider="{mydata}"
   mx:columns
   mx:Array
   mx:DataGridColumn columnName="EMPNO" /
  mx:DataGridColumn columnName="ENAME" /
  /mx:Array
 /mx:columns
/mx:DataGrid
-

In the example below the "myservice.result.data.row" is an XML
structure::

row
 EMPNO346546/EMPNO
 ENAMEJohn Roberts/ENAME
/row
row
 EMPNO346546/EMPNO
 ENAMEJohn Roberts/ENAME
/row









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  










Re: [flexcoders] Dynamic DataGridColumns

2006-02-14 Thread Hari Kolasani






Thanks very much. That worked.

Anatole Tartakovsky wrote:

  
  
  
  That is "columns"
property of DataGrid - you do need to to loop through your XML to
create DataGridColumn instances - here is internal demo of framework
object that does it via data driven UI:
  http://demo.xmlsp.net/dataservice%206/dataservice%206.html
  HTH,
  Anatole Tartakovsky
  
  
  
-
Original Message - 
From:
Hari
Kolasani 
To:
flexcoders@yahoogroups.com

Sent:
Tuesday, February 14, 2006 5:23 PM
Subject:
[flexcoders] Dynamic DataGridColumns


Flexcoders,

Is there any way to assign the DataGridColumns dynamically? 

Instead of hardcoding each of the DataGridColumn, I would like to
dynamically create an Array of them using the 'mydata' ArrayCollection.

-
var mydata:ArrayCollection = new
ArrayCollection(myservice.result.data.row);

mx:DataGrid id="zndg" width="100%" height="100%"
dataProvider="{mydata}"
   mx:columns
   mx:Array
   mx:DataGridColumn columnName="EMPNO" /
  mx:DataGridColumn columnName="ENAME" /
  /mx:Array
 /mx:columns
/mx:DataGrid
-

In the example below the "myservice.result.data.row" is an XML
structure::

row
 EMPNO346546/EMPNO
 ENAMEJohn Roberts/ENAME
/row
row
 EMPNO346546/EMPNO
 ENAMEJohn Roberts/ENAME
/row




  







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  










Re: [flexcoders] Flex 2 addTreeNode

2006-02-07 Thread Hari Kolasani






I think , the Flex 2.0 Tree related classes have been changed quite a
bit with the introduction of Hierarchical Data Providers and stuff. 

Here is some sample .mxml/as code that worked for me. Hope this will
help.

- Hari

*
?xml version="1.0" encoding="utf-8"?
mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"
backgroundColor="#FF" creationComplete="initList()"
 mx:Script
  ![CDATA[
  import mx.collections.XMLListCollection;
  
  var origXML:XML;

  public function initList() 
  {
   myTree.rootVisible = false;

   //TODO: Get this XML from a data service
   var origXMLString:String = "MyRoot " + 
   "node1
label=\"supernode1\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
   "node2
label=\"supernode2\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
   "node3
label=\"supernode3\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
  "/MyRoot";
   
   origXML = new XML(origXMLString);
   myTree.dataProvider = origXML;
  }
  public function open(event:Object)
  {
   var selectedNode:Object =event.node;
   
   var myXMLList:XMLList = new XMLList(selectedNode);
   
   //TODO: Get this XML from a data service
based on the selected node.
   var newXMLString:String = "childnode1
label=\"childnode1\" someProp=\"sdsdf \" isBranch=\"true\" /" + 
 "childnode2
label=\"childnode2\" someProp=\"sdsdf \" isBranch=\"false\" /" + 
  "childnode3
label=\"childnode3\" someProp=\"sdsdf \" isBranch=\"true\" /" ; 
   
   var myNewXMLList:XMLList = new XMLList(newXMLString);
   
   selectedNode.setChildren(myNewXMLList);
   
   myText1.text = selectedNode.toXMLString();
   myText2.text = myTree.dataProvider.source[0];
   myTree.dataProvider = origXML;
  }
  
  public function close(event:Object)
  {
   var selectedNode:Object = event.node;
   
   var myXMLList:XMLList = new XMLList(selectedNode);
   
   removeAllDecendants(myXMLList);
   
   myText1.text = selectedNode.toXMLString();
   myText2.text = myTree.dataProvider.source[0];
   myTree.dataProvider = origXML;
  }
  
  public function removeAllDecendants(xmlList:XMLList)
  {
   var myDescendantXMLList:XMLList = xmlList.descendants();
   var myDecendentXMLListCollection:XMLListCollection = new
XMLListCollection(myDescendantXMLList);
   myDecendentXMLListCollection.removeAll();
  }

 ]]
 /mx:Script

 !-- Simple example to demonstrate the Tree control --
 mx:XML id="myxml"
 /mx:XML

 mx:HDividedBox width="100%" height="100%"

 !-- Tree listing of directories (only) --
 mx:Box
mx:Tree id="myTree" width="600" height="600"
labelField="@label" defaultLeafIcon="@Embed('images/folder.gif')"
nodeOpen="open(event)" nodeClose="close(event)"/
 /mx:Box

  mx:VBox
  !-- Text Areas to Display Node XMLs --
  mx:Box
   mx:TextArea width="600" height="300" id="myText1"
/
  /mx:Box
 mx:Box
   mx:TextArea width="600" height="300" id="myText2"
/
  /mx:Box
 /mx:VBox
 /mx:HDividedBox
/mx:Application
*

Brendan Meutzner wrote:

Hi,
  
Can someone provide me with an example of addTreeNode for Flex 2? I
have a XML structure that is loaded into my Tree as the dataProvider.
I would like to be able to click on a node within the tree, and then
add a sub node into that selected node. When I get the selectedNode
from the tree, and attempt call addTreeNode on it, I get an error
"Call attempted on an object that is not a function"...
  
Unfortunately, not much documentation on these methods yet, so any
help offered would be very much appreciated.
  
Brendan
  
  
  
  
  








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  










Re: [flexcoders] Yahoo Maps Flex 2

2006-02-06 Thread Hari Kolasani






First of all , I think you need to include the .SWC file in the Build
Path. 

Secondly, I don't think Yahoo Maps Flex API is supported in
Flex2/Action Script 3.

- Hari

Jonathan Miranda wrote:

  
  
  
  
  Anyone got a no-brainer
solution to this or know somewhere
where I can find this information? Im trying something just real basic
with the SWC in the root of the project and Im getting YahooMap
is not a compile-time constant or something close to that. Ideas?
  
?xml version="1.0"?
  mx:Application
xmlns:mx="http://www.macromedia.com/2005/mxml"
xmlns:yahoo="com.yahoo.maps.api.flex.*" xmlns:local="*"
xmlns="*" 
  yahoo:YahooMap
id="myMap"
width="550" height="400" zoomLevel="3"
latitude="37.77159" longitude="-122.401714"
initialize="onInitialize(event);" /
  /mx:Application
  _
  Jonathan
Miranda
  Flexible
Master of
the Web
  "In the
game of
chess, it's important to never let your opponent see your pieces."
  
  








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  










Re: [flexcoders] Re: Tree control in Flex 2 Beta 1

2006-02-06 Thread Hari Kolasani






I think , the Flex 2.0 Tree related classes have been changed quite a
bit with the introduction of Hierarchical Data Providers and stuff. 

Here is some sample .mxml/as code that worked for me. Hope this will
help.

- Hari

*
?xml version="1.0" encoding="utf-8"?
mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"
backgroundColor="#FF" creationComplete="initList()"
 mx:Script
  ![CDATA[
  import mx.collections.XMLListCollection;
  
  var origXML:XML;

  public function initList() 
  {
   myTree.rootVisible = false;

   //TODO: Get this XML from a data service
   var origXMLString:String = "MyRoot " + 
   "node1
label=\"supernode1\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
   "node2
label=\"supernode2\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
   "node3
label=\"supernode3\" someProp=\"sdsdf \" isBranch=\"true\"/" + 
  "/MyRoot";
   
   origXML = new XML(origXMLString);
   myTree.dataProvider = origXML;
  }
  public function open(event:Object)
  {
   var selectedNode:Object =event.node;
   
   var myXMLList:XMLList = new XMLList(selectedNode);
   
   //TODO: Get this XML from a data service
based on the selected node.
   var newXMLString:String = "childnode1
label=\"childnode1\" someProp=\"sdsdf \" isBranch=\"true\" /" + 
 "childnode2
label=\"childnode2\" someProp=\"sdsdf \" isBranch=\"false\" /" + 
  "childnode3
label=\"childnode3\" someProp=\"sdsdf \" isBranch=\"true\" /" ; 
   
   var myNewXMLList:XMLList = new XMLList(newXMLString);
   
   selectedNode.setChildren(myNewXMLList);
   
   myText1.text = selectedNode.toXMLString();
   myText2.text = myTree.dataProvider.source[0];
   myTree.dataProvider = origXML;
  }
  
  public function close(event:Object)
  {
   var selectedNode:Object = event.node;
   
   var myXMLList:XMLList = new XMLList(selectedNode);
   
   removeAllDecendants(myXMLList);
   
   myText1.text = selectedNode.toXMLString();
   myText2.text = myTree.dataProvider.source[0];
   myTree.dataProvider = origXML;
  }
  
  public function removeAllDecendants(xmlList:XMLList)
  {
   var myDescendantXMLList:XMLList = xmlList.descendants();
   var myDecendentXMLListCollection:XMLListCollection = new
XMLListCollection(myDescendantXMLList);
   myDecendentXMLListCollection.removeAll();
  }

 ]]
 /mx:Script

 !-- Simple example to demonstrate the Tree control --
 mx:XML id="myxml"
 /mx:XML

 mx:HDividedBox width="100%" height="100%"

 !-- Tree listing of directories (only) --
 mx:Box
mx:Tree id="myTree" width="600" height="600"
labelField="@label" defaultLeafIcon="@Embed('images/folder.gif')"
nodeOpen="open(event)" nodeClose="close(event)"/
 /mx:Box

  mx:VBox
  !-- Text Areas to Display Node XMLs --
  mx:Box
   mx:TextArea width="600" height="300" id="myText1"
/
  /mx:Box
 mx:Box
   mx:TextArea width="600" height="300" id="myText2"
/
  /mx:Box
 /mx:VBox
 /mx:HDividedBox
/mx:Application
*


Jason Y. Kwong wrote:
I'm really at a lost as to how we're supposed to work with
the hierarchical data that's used with the Tree component. The XML
approach seems to be the most supported at the moment, so consider this
simple XML:
  
 var rootNode: XML =
  
 node label="Root"
   node label="Child1"/
   node label="Child2"/
 /node
  
The dataProvider for the Tree then becomes an XMLListCollection. It
displays fine. But now what's the expected way to modify the data so
that the Tree updates? From the docs, I read:
  
  
"You can use the ICollectionView interface with list-based or
hierarchical data. The following sections describe the basic
ICollectionView operations using a list-based collection, but can also
apply to similar operations on a hierarchical collection."
  
How is ICollectionView used with hierarchical data? Michael Montagna
gave a hint in the quoted code at the bottom, but it seems like
XMLListCollection is no more hierarchy-aware than ArrayCollection. If
I use a cursor with the above example, I find that the collection has
just one item--the root node. I can add siblings to the root node via
the cursor, but that's not very useful. How do I get to the children
via the collection/cursor?
  
  
So then I tried modifying the XML objects directly. I tried doing this:
  
 [EMAIL PROTECTED] = "Hello";
  
And to my surprise, the Tree updated! So I thought this was the
answer. Well, sort of. With the root node open in the Tree, I tried
this:
  
  
 rootNode.appendChild(node label="Child3"/);
  
The Tree does update itself with a new row, but it shows up empty (I
can select it, though). If I collapse and expand the root, Child3
shows up ok. Now, if I try this:
  
  
 rootNode.node[1].appendChild(node label="Child3"/);
  
The Flash Player crashes, taking the browser with it. Looks like
converting a leaf to a branch while it's being displayed is a no-no.
Works ok if the root node is collapsed.