topical media & game development

talk show tell print

#springgraph-sample-RoamerDemo.mx

#springgraph-sample-RoamerDemo.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" xmlns:fc="http://www.adobe.com/2006/fc"
           layout="absolute"
           creationComplete="setup()" backgroundGradientColors="[#888888,#333333]" 
           >
          
          <!--
  

///////////////////////////////////////////////////////////////////////

// // Copyright (C) 2006 Adobe Macromedia Software LLC and its licensors. // All Rights Reserved. The following is Source Code and is subject to all // restrictions on such code as contained in the End User License Agreement // accompanying this product. //

///////////////////////////////////////////////////////////////////////

--> <!-- RoamerDemo.mxml is an application that demonstrates the Roamer component. --> <fc:Roamer id="roamer" bottom="0" itemRenderer="springgraph_sample_RoamerDemo_XMLItemView" repulsionFactor="{repulsion.value}" maxDistanceFromCurrent="{maxDistanceFromCurrent.value}" itemLimit="{maxVisible.value}" autoFit="{autoFit.selected}" motionThreshold="{motionThreshold.value}" change="if(infoText != null) infoText.text = roamer.fullNodeCount + ' items, ' + roamer.visibleNodeCount + ' visible.';" right="0" left="0" top="0"> <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:Roamer> <mx:Button x="27" y="442" label="Hide current item" click="roamer.hideItem(roamer.currentItem)" width="103" fontSize="9"/> <mx:Text fontSize="9" color="#dddddd" fontWeight="bold" textAlign="left" width="114" htmlText="&lt;a href=&quot;http://mark-shepherd.com">mark-shepherd.com</a>" x="10" y="29"/> <mx:Label x="10" y="290" text="max number visible" fontSize="9" width="133" textAlign="center" color="#dddddd"/> <mx:HSlider x="10" y="273" width="133" id="maxVisible" snapInterval="1" value="50" minimum="20" maximum="150" liveDragging="true"/> <mx:CheckBox selected="true" id="autoFit" x="11" y="365" label="Auto-fit items to window" color="#dddddd"/> <mx:Label x="11" y="407" text="item spacing" fontSize="9" width="133" textAlign="center" color="#dddddd"/> <mx:HSlider x="11" y="393" width="133" id="repulsion" value="{roamer.repulsionFactor}" minimum="0.01" maximum="1.5" liveDragging="true"/> <mx:CheckBox x="11" y="323" label="Show history" color="#dddddd" selected="true" change="roamer.showHistory = event.currentTarget.selected"/> <mx:Label x="10" y="243" text="max degrees of separation" fontSize="9" textAlign="left" color="#dddddd"/> <mx:HSlider x="10" y="224" width="133" id="maxDistanceFromCurrent" value="3" minimum="1" maximum="5" liveDragging="true" snapInterval="1" height="25"/> <mx:Text x="10" y="10" text="Roamer Component Demo" fontSize="12" color="#dddddd" fontWeight="bold"/> <mx:Text x="10" y="68" text="no data loaded" id="infoText" fontSize="9" color="#dddddd"/> <mx:Text x="10" y="92" id="help" fontSize="9" color="#ffff00"/><!-- text="Click a button to load some data" --> <mx:Label visible="false" x="9" y="443" text="motion stop threshold" fontSize="9" width="133" textAlign="center" color="#dddddd"/> <mx:HSlider visible="false" x="9" y="429" width="133" id="motionThreshold" value="{roamer.motionThreshold}" minimum="0.01" maximum="2" liveDragging="true"/> <mx:Button id="fromWideDataButton" x="10" y="146" label="~25 links/node (600 KB)" click="wideExternalData.send();" width="136" fontSize="9"/> <mx:Button id="fromSmallDataButton" x="10" y="117" label="small sample (30 KB)" click="smallExternalData.send();" width="137" fontSize="9"/> <mx:Button id="fromBigDataButton0" x="10" y="175" label="~7 links/node (1.4 MB)" click="bigExternalData.send();" width="136" fontSize="9"/> <mx:Label x="150" y="121" text="*" color="#dddddd" id="currentDataIndicator"/> <mx:HTTPService id="bigExternalData" url="http://mark-shepherd.com/SpringGraph/RoamerDemo/bin/data7.7.7.7.7.xml" showBusyCursor="true" resultFormat="e4x" result="gotData(['n','e','f','t'], event, fromBigDataButton0)"/> <mx:HTTPService id="wideExternalData" url="http://mark-shepherd.com/SpringGraph/RoamerDemo/bin/data25.25.25.xml" showBusyCursor="true" resultFormat="e4x" result="gotData(['n','e','f','t'], event, fromWideDataButton)"/> <mx:HTTPService id="smallExternalData" url="http://mark-shepherd.com/SpringGraph/RoamerDemo/bin/dataSmall.xml" showBusyCursor="true" resultFormat="e4x" result="gotData(['Node','Edge','fromID','toID'], event, fromSmallDataButton)"/> <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; } private function gotData(xmlNames: Array, event: ResultEvent, button: Button): void { maxDistanceFromCurrent.value = 2; roamer.resetHistory(); roamer.resetShowHide(); roamer.xmlNames = xmlNames; roamer.dataProvider = event.result as XML; changeHelp1(); currentDataIndicator.y = button.y + 4; } public function itemDoubleClick(event: Event): void { roamer.currentItem = event.currentTarget.data; changeHelp2(); } private function changeHelp1(): void { help.text = "Double click an item to make it the current item, drag the background to scroll"; } private function changeHelp2(): void { help.text = "Choose another data source, or try the other roamer controls"; var t:Timer = new Timer(10000, 1); t.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete); t.start(); } public function onTimerComplete(evt:TimerEvent):void { help.visible = false; } ]]> </mx:Script> </mx:Application>


(C) Æliens 04/09/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.