2 Replies Latest reply on Mar 11, 2008 12:43 PM by Pinnennet

    Flash tree component

    Pinnennet
      Hi! To start with, im very sorry for my pour english.

      I have created a tree called myTree and im using this actionscript:



      //XML

      // create xml object
      var xml:XML = new XML();
      // ignore any white space
      xml.ignoreWhite = true;
      // onload xml function
      xml.onLoad = function(){
      // link tree to xml file database
      myTree.dataProvider = this.firstChild;
      }
      // load xml file
      xml.load("tree.xml");
      // create obj for the tree listener
      var treeListener:Object = new Object();
      // event function for listener
      treeListener.change = function(){
      // what is clicked on in tree
      var item = myTree.selectedItem;
      // the url attribute of that item
      var myurl = item.attributes.url;
      //var mylarare = item.attributes.larare;
      // if there is an element
      // and it is not a folder


      if(myurl){




      loader.contentPath = " http://www.XXXXX.se/db/lektioner/" + myurl + "/preview.swf";

      trace("Selected: " + myurl);

      }
      }
      // register listener with function and object
      myTree.addEventListener("change",treeListener);



      When im using it, it works perfect when i select my first object. The loader loads it, but when i try to change to the next object and loader "swf number 2" it just becomes blank. If i reload the swf and select "swf number 2" first, i wont be able to switch to "swf nummber 1".

      Please help me!
        • 1. Re: Flash tree component
          Pinnennet Level 1

          "When im using it, it works perfect when i select my first object. The loader loads it, but when i try to change to the next object and loader "swf number 2". If i reload the swf and select "swf number 2" first, i wont be able to switch to "swf nummber 1"."




          What i ment is that i can load one swf in to the loader. But when i try to load another swf (in this case that i change folder and there by also swf) it wont work.
          • 2. Flash tree component
            Pinnennet Level 1
            I have found some new interesting things about this problem. if i change the code to:

            box.text = " http://www.xxxxx.se/db/lektioner/" + myurl + "/preview.swf";
            loader.contentPath = box.text;

            It still gives the same result but, the textbox called "box" allways gives me the right URL! So the box.text is right, but it seams like i cant load it in to the loader :S