1 Reply Latest reply on Nov 12, 2008 2:40 AM by Devendran

    on click at tree component it has to call SWF using XML

    rnjithkumar
      Hi,

      I have created a flash file with name xmltoflash_tree. Incules a Tree component named "tree01". On my first frame of actions i have included "#include "test.as"". This is about my flash file

      In my Test.as :

      import mx.controls.Tree;

      var xmlLoader:XML = new XML();
      xmlLoader.ignoreWhite = true;
      xmlLoader.load("list.xml");
      xmlLoader.onLoad = function(success:Boolean):Void {
      tree01.dataProvider = this;
      tree01.initBranches();
      }

      tree01.vScrollPolicy = "auto";

      Tree.prototype.initBranches = function(node:XMLNode):Void {
      if (node == undefined) {
      for (var i = 0; i < this.dataProvider.childNodes.length; i++) {
      this.initBranches(this.dataProvider.childNodes );
      }
      } else {
      if ( (node.attributes.isBranch == "true") && !(this.getIsBranch(node)) ) {
      this.setIsBranch(node, true);
      }
      if ( (node.attributes.isOpen == "true") && !(this.getIsOpen(node)) ) {
      this.setIsOpen(node, true);
      }
      for (var i = 0; i < node.childNodes.length; i++) {
      this.initBranches(node.childNodes
      );
      }
      }
      }


      I created an XML file named as "list.xml" :

      Script inside this xml is :

      <?xml version="1.0" encoding="iso-8859-1"?>

      <node label="Select Application" isOpen="true">

      <node label="Application1" isBranch="true">
      <node label="Introduction to Application1" isBranch="true" >
      <node label="Testing1" />
      <node label="Testing2" />
      <node label="Testing3" />
      </node>
      </node>

      <node label="Application2" isBranch="true">
      <node label="Introduction to Application2" isBranch="true" >
      <node label="Testing1" />
      <node label="Testing2" />
      <node label="Testing3" />
      </node>

      </node>


      I have folder with name Treehelp. All my files are in this folder.
      xmltoflash_tree.fla
      test.as
      list.xml
      linktesting.swf

      I have SWF in the same folder named "linktesting.swf".

      I need to call "linktesting.swf" or any other swf files included in the same folder. when i click on "Testing1/ or any othe".

      Have to write the script in XML to call the swf file. Help me in this.

      Regards
      Ranjith Kumar. Bandi