2 Replies Latest reply on Nov 26, 2007 11:47 AM by sirtcarlos

    loading txt & xml issues

    sirtcarlos Level 1
      I've been going in circles trying to figure this out...
      I am creating 3 text areas on the opening of my Flash:

      import mx.controls.TextArea;

      createClassObject(TextArea,"title_txt",this.getNextHighestDepth(),{_width:236, _height:150, _x:380, _y:54, hScrollPolicy:"off", vScrollPolicy:"off", wordWrap:true, editable:false});

      var titleTxt:LoadVars = new LoadVars();
      titleTxt.onData = function(src:String):Void {
      if (src != undefined) {
      title_txt.depthChild0._alpha = 0;
      title_txt.setStyle("color",0xFFFFFF);
      title_txt.setStyle("fontFamily","Myriad Pro");
      title_txt.setStyle("fontSize",34);
      title_txt.text = src;
      } else {
      title_txt.text = "welcome!";
      }
      };
      titleTxt.load(" http://www.url.com/upload/title.txt");


      createClassObject(TextArea,"description_txt",this.getNextHighestDepth(),{_width:175, _height:213, _x:440, _y:150, hScrollPolicy:"off", vScrollPolicy:"auto", wordWrap:true, editable:false});

      var descrTxt:LoadVars = new LoadVars();
      descrTxt.onData = function(src:String):Void {
      if (src != undefined) {
      description_txt.depthChild0._alpha = 0;
      description_txt.setStyle("color",0xFFFFFF);
      description_txt.setStyle("fontFamily","Arial");
      description_txt.text = src;
      } else {
      description_txt.text = "There is currently no information in this area. Please check back shortly.";
      }
      };
      descrTxt.load(" http://www.url.com/upload/description.txt");


      createClassObject(TextArea,"fact_txt",this.getNextHighestDepth(),{_width:280, _height:75, _x:45, _y:295, hScrollPolicy:"off", vScrollPolicy:"off", wordWrap:true, editable:false});

      var factTxt:LoadVars = new LoadVars();
      factTxt.onData = function(src:String):Void {
      if (src != undefined) {
      fact_txt._alpha = 0;
      fact_txt.setStyle("color",0x003366);
      fact_txt.setStyle("fontSize",16);
      fact_txt.setStyle("fontFamily","Handwriting - Dakota");
      fact_txt.setStyle("textAlign","center");
      fact_txt.text = src;
      } else {
      fact_txt.text = "No info at this time.";
      }
      };
      factTxt.load(" http://www.url.com/upload/fact.txt");
      stop();


      this properly loads the 3 text files into 3 text areas that are created.
      however, what i need to happen is for buttons on the stage to load different text files on(release).
      on(release) of the buttons must also load an xml file that will pull the urls to images into an emty MC on the stage.
      I currently can't get any of this to load from the button. here is the button code:

      on (release) {
      titleTxt.load(" http://www.url/upload/newstitle.txt");
      descrTxt.load(" http://www.url/upload/newDescr.txt");
      factTxt.load(" http://www.url/upload/newFact.txt");

      vtPhoto = new XML();
      vtPhoto.ignoreWhite = true;
      vtPhoto.onLoad = function(success) {
      numimages = this.firstChild.childNodes.length;
      spacing = 78;
      for (i=0; i<4; i++) {
      this.picHolder = this.firstChild.childNodes ;
      this.picHolder.onLoad = this.firstChild.childNodes
      ;
      this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
      this.thumbHolder._x = i*spacing;
      this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
      this.thumbLoader.loadMovie(this.picHolder.attributes.noythmb);
      this.thumbHolder.noymain = this.picHolder.attributes.noymain;
      this.thumbHolder.onRelease = function() {
      loader.loadMovie(this.noymain);
      };
      }
      };

      vtPhoto.load(" http://www.ur/upload/xmlimages.xml"); */
      }


      any and all help is much appreciated!
        • 1. Re: loading txt &amp; xml issues
          nstanz Level 1
          add an allow domain line to your AS code.
          Search the help file for Security, allow domain
          • 2. Re: loading txt &amp; xml issues
            sirtcarlos Level 1
            nstanz,
            good pt about the allow domain...i actually did know that, just forgot to include it...however, even after adding it to the code nothing is happening. i added:
            System.security.allowDomain(" http://www.myurl.edu");
            to the first line in frame 1 (I believe I just have to add it in one instance and then it is good for the entire movie right?). in any case, tried adding it once, and tried adding it on the button's script. neither worked.
            any other suggestions? would it make any difference if i pulled all the text into 1 xml file (per button)?