views:

8

answers:

1

Hi, I have the php backend that displays an xml page with data for flash consuming. Flash takes it and creates a textfields dynamicaly based on this information. I have a few items in menu on top and when I click one of them, data is taken from php and everything is displayed in scroll in flash. The problem is that if I click too fast between menu items, then I get buggy layout. The text (only the text) is becoming part of the layout and is displayed no metter what item in menu I am currently in and only refreshing the page helps.

var myXML:XML = new XML();

myXML.ignoreWhite=true;

myXML.load("/getBud1.php");

myXML.onLoad = function(success){

if (success){

var myNode = this.firstChild.childNodes;

var myTxt:Array = Array(0);

  for (var i:Number = 0; i<myNode.length; i++) {

      myTxt[i] = "text"+i+"content";

createTextField(myTxt[i],i+1,65,3.5,150, 20);

var pole = eval(myTxt[i]);

      pole.embedFonts = true;

      var styl:TextFormat = new TextFormat();

      styl.font = "ArialFont";

      pole.setNewTextFormat(styl);

      pole.text = String(myNode[i].childNodes[1].firstChild.nodeValue);

      pole.wordWrap = true;

        pole.autoSize = "left";

        if(i > 0) {

        var a:Number = eval(myTxt[i-1])._height + eval(myTxt[i-1])._y + 3;

        pole._y = a;
        } 
        attachMovie("kropka2", "test"+i+"th", i+1000);

        eval("test"+i+"th")._y = pole._y + 5;

        eval("test"+i+"th")._x = 52;

  } 

} }

I tried to load the info and ceate text fields from top frame and then refer to correct place by instance names string e.g. budData.dataHolder.holder.createTextField , but then when I change between items in menu the text dissapears completely untill I refresh the page.

Please help

A: 

Issue resolved... I created raw as2 code and whenever I loaded data from XML, the variables were initialized later than the reading from them part. I wrapped everything into the function and loaded xml data on 1st frame into the array, then I read data from another function and it works.

ortho