topical media & game development

talk show tell print

explorer-mxml.mx

explorer-mxml.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:explorer="*" 
      width="100%" height="100%" pageTitle="Adobe Flex 3 Component Explorer" 
  initialize="populateTree();">
  
  

script


      <mx:Script>
          <![CDATA[
          import mx.controls.Alert;
  
          private function treeChanged(event:Event):void
          {
              var nodeApp:String = compLibTree.selectedItem.@app;
              if (nodeApp != null && nodeApp != "")
              {
                swfLoader.loadApp(nodeApp + ".swf");
                vs.loadSource(nodeApp, compLibTree.selectedItem.@src);
              }
              else
              {
                  compLibTree.expandItem(compLibTree.selectedItem, true, true);
              }
          }
  
          private function sdkLoaded():void
          {
              Alert.show("sdk loaded");
              explorerTree = XML(sdk.lastResult.node);
              charts.send();
          }
  
          private function chartsLoaded():void
          {
              explorerTree.appendChild(charts.lastResult.node);
              populateTree()
              //Alert.show("tree populated");
          }
  
          //we don't use data binding because the timing of the charts loading can be off
          private function populateTree():void
          {
              compLibTree.dataProvider = explorerTree;
              //Alert.show("tree populated");
          }
  
          private function no_connection():void
          {
              Alert.show("no connection");
          }
          ]]>
      </mx:Script>
  
  

data


  
  <mx:XML id="explorerTree">
  <load xml="explorer-mxml"/>
  </mx:XML>
  
  

url -- does not work


  <mx:HTTPService id="sdk" url="explorer-mxml.xml" resultFormat="e4x" result="sdkLoaded();" fault="no_connection();" />
  
  <mx:HTTPService id="charts" url="charts_explorer.xml" resultFormat="e4x" result="chartsLoaded();" fault="populateTree()" />
  
  

layout


      <mx:HDividedBox width="100%" height="100%">
          <mx:Panel width="30%" height="100%" title="Adobe Flex 3 Component Explorer">
              <mx:Tree id="compLibTree" width="100%" height="100%" showRoot="false" labelField="@label"
                       change="treeChanged(event);"/>
          </mx:Panel>
          <mx:VDividedBox width="100%" height="100%">
              <explorer:explorer_loaderPanel id="swfLoader" width="100%" height="50%"/>
              <mx:VBox width="100%" height="50%" backgroundColor="#FFFFFF">
                  <explorer:explorer_viewsource id="vs" width="100%" height="100%"/>
              </mx:VBox>
          </mx:VDividedBox>
      </mx:HDividedBox>
  </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.