topical media & game development

talk show tell print

#graph-roamer.mx

#graph-roamer.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:fc="http://www.adobe.com/2006/fc"
  >
  
  <mx:Script>
  <![CDATA[
                            import com.adobe.flex.extras.controls.springgraph.SpringGraph;
                            import mx.rpc.events.ResultEvent;
                            import com.adobe.flex.extras.controls.springgraph.Item;
                            import com.adobe.flex.extras.controls.springgraph.Graph;
                            
                            private function setup(): void {
                                    //smallExternalData.send();
                                    //roamer.repulsionFactor = 0.4;
                                    //roamer.showHistory = true;
                                    //roamer.currentItem = 
                            }
          
  ]]>
  </mx:Script>
            
  <mx:Text x="10" y="14" text="no data loaded" id="infoText" fontSize="9" color="#dddddd"/>        
  <mx:HSlider x="403" y="14" width="114" id="repulsion" value="0.5" minimum="0.0" maximum="1.5" liveDragging="true"/>
  
          <fc:Roamer id="roamer" width="100%" bottom="0" top="40" 
                  repulsionFactor="{repulsion.value}" 
                  xmlNames="[thing,connect,source,dest]"       
          maxDistanceFromCurrent="2" 
          itemLimit="12"
          autoFit="true"
          motionThreshold="1"
          change="if(infoText != null) infoText.text = roamer.fullNodeCount + ' items, ' + roamer.visibleNodeCount + ' visible.';"
          >
    
         <fc:removeItemEffect>
              <mx:Fade alphaFrom="1" alphaTo="0" duration="1000"/>                                
          </fc:removeItemEffect>
                    
          <fc:addItemEffect>
              <mx:Fade alphaFrom="0" alphaTo="1" duration="1000"/>
         </fc:addItemEffect>
                  <fc:dataProvider>
                          <mx:XML xmlns="">
                                  <stuff>
                                                  <thing id="4" prop="FRUITS"/>                                
                                                  <thing id="1" prop="apple"/>
                                                  <thing id="2" prop="orange"/>
                                                  <thing id="3" prop="pear"/>
                                                  
                                                  <connect source="4" dest="1"/>
                                                  <connect source="4" dest="2"/>
                                                  <connect source="4" dest="3"/>
                                          
                                  </stuff>
                          </mx:XML>
                  </fc:dataProvider>
                  
                  <fc:itemRenderer>
                          <mx:Component>
                                  <mx:Label fontSize="14" text="{data.data.@prop}" color="#ffffff"/>                                        
                          </mx:Component>
                  </fc:itemRenderer>
          </fc:Roamer>
  
          
  </mx:Application>
  


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.