7 Replies Latest reply on Apr 11, 2007 6:17 PM by bigj9901

    Please Help, Dynamically attached dynamic textbox

    ahmedmasri
      Hello,

      I'm creating a timeline structured site where a movie clip on the stage called 'slider' is set to slide automatically according to how far left, or right the mouse position is from the center of the stage. This works. I even have it set it up so that using two variables, i can decide how much or even which portion of the movie clip (or the timeline) the user is allowed to slide around in.

      I then have a movieclip called 'yearMarker' which is attached at runtime inside the 'slider' movie clip. This is done through a While loop and PHP script which retrieves from the database the field values for "year" (just a string denoting the particular year in question), and "yearXPosition" (which is how far along on the x axis the attached movie clip should be.

      the string I retreive from php looks like this:

      yearOf1=1976&yearPosition1=0&yearOf2=1977&yearPosi tion2=350&yearOf3=1978&yearPosition3=1350&yearOf4= 1979&yearPosition4=1700&yearOf5=1980&yearPosition5 =2050&...ect.
      (I used the variable name 'yearOf' in place of year because flash already has a class property with that name.

      I managed to attach the 'yearMarker' movie clip at the right x distance from the left border of the stage, and it works well.

      My problem is whith a dynamic textbox within the 'yearMarker' movieclip. The intention is that when the movieclip is attached, the dynamic textbox within, 'yearMarkerText", is given the value of the Year in question, 'yearOf'.

      Not only can I not get this part to work, It also seems that the textbox disapears altogether, though if I set the textbox to be selectable and then test the movie, the mouse cursor changes to select text where the textbox should be if it was visible.

      The code, on the first frame on the root of the timeline, which attaches a movie clip based on the above values goes like this:

      var yearMarkersVar = new LoadVars()
      yearMarkersVar.load(" http://localhost/script/yearmarker.php");
      yearMarkersVar.onLoad = loadYearVariables;

      function loadYearVariables(){
      // For Loop that will create a "yearMarker" for each year in the list
      for (i = 1; i < this.totalyears; i++) {

      // Create simpler variable names to use later
      yearOf = this["yearOf"+i];
      yearPosition = this["yearPosition"+i];
      yearMarker = "yearMarker"+i;

      // attach movie clip
      slider.attachMovie("yearmarker01", yearMarker, i, {_x:yearPosition, _y:273});


      // THIS SHOULD PRINT THE TEXT!
      slider.yearMarker.yearMarkerText.text = yearOf;
      // TREID THIS TOO
      level = ["_level"+i];
      level.yearMarkerText.text = yearOf;

      }

      // set variable to be used by 'slider' as end limit
      _global.mcWidthTotal = this.mcWidthTotal;
      trace(_global.mcWidthTotal);
      }

      Flash bug? something Im completely missing? am i an ediot? does anyone know how to solve this? im desperate.



      thanks
      -ahmed