why not just use a viewstack and toggle to the children. I dont get why you 
keep recreating and adding the forms over and over again.


----- Original Message ----
From: Tom Preet <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, February 12, 2008 5:47:38 AM
Subject: [flexcoders] Tree Nodes with new Application

Hi All,
 
In my application am using Tree with nodes  when I click on the node it was 
displaying the alert,
but when I selected the first node the related page was displaying, next time 
when I click
on another node it was not displaying the second page.
Now I need to use it as when I click on particular node the related page was 
displayed.
how to refresh the nodes when selecting the each node simultaniously.

My Application:<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe. com/2006/ mxml" width="1094" 
height="640" verticalScrollPolic y="off" horizontalScrollPol icy="off">
 <mx:Script>
  <![CDATA[
  import mx.controls. Alert;
  private function changeEvt(event: Event):void {
  
   var selectedNode: String = ""
   if (event.currentTarget .selectedItem. @data ) 
   {
    
   selectedNode = event.currentTarget .selectedItem. @label;
   //Alert.show("the data "+selectedNode) ;
   
     if(selectedNode= ="abc Node")
     {
      
      var abc:abcForm = new abcForm();
     
     rightPane.addChild( abc);
     }
    else if(selectedNode= ="ddd Node")
     {
      Alert.show("Access");
      var ddd:ddForm = new ddForm();
      
      rightPane.addChild( ddd);
     }
  else if(selectedNode= ="zzz Node")
     {
      Alert.show("Error");
      var zzz:zzForm = new zzForm();
     
     rightPane.addChild( zzz);
     }
   }
   }
  
  ]]>
 </mx:Script>
 
 <mx:HBox width="1089" id="rightPane" height="630" x="5" y="10" 
verticalScrollPolic y="off" horizontalScrollPol icy="off">
 <mx:VBox width="230" height="627" verticalGap="10">
  <mx:Panel width="229" height="628" title="Tree" verticalScrollPolic y="off" 
horizontalScrollPol icy="off" backgroundColor="white">       
  <mx:Tree id="TreeForm"   change="changeEvt(event)" labelField="@label" 
showRoot="true" width="210" height="595">
   <mx:XMLListCollectio n id="nodes">
   <mx:XMLList>
   <node label="abc Node" />
   <node label="Main Forms"  isBranch="true" >
   <node label="ddd Form"  />
   <node label="zzz Form"/>
   </node>
   </node>
   </mx:XMLList>
   </mx:XMLListCollecti on>
   </mx:Tree>
      </mx:Panel>
 </mx:VBox>       
 </mx:HBox>
</mx:Canvas>
 
can anyone help me how to achieve this..
Thanks in Advance..
--tomt




      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to