3 Replies Latest reply on Jul 11, 2011 8:58 AM by Ned Murphy

    Dynamically change text during narration

    jacquesge Level 1



      I've got a file that contains narration. The content appears progressively on the stage as narration plays.


      On the first frame I added a dynamic textfield, which I called : soustitrage_txt (would be "caption_txt" in English).


      On another layer, on the same frame I added this code :


      soustitrage_txt.html = true;
      soustitrage_txt.autoSize = "left";
      soustitrage_txt.selectable = true;
      soustitrage_txt.multiline = true;
      soustitrage_txt.wordWrap = true;


      var txtFormat:TextFormat = new TextFormat();
      txtFormat.size = 20;
      txtFormat.font = "Arial";

      txtFormat.bold= true;

      //I exagerated the value, to be sure it's really not working...

      _global.myData = new LoadVars();

      _global.myData.onLoad = function() {



      I need to make appear the first sentence around the frame 115, in which I entered this code on my "action layer" :


      soustitrage_txt.text = _global.myData.phrase1;


      One positive point, the text appears (yay!) but the negative point is that the formatting doesn't work...


      Finally, when I want to switch to the next phrase, around frame 195, I enter the same code (with only a different variable name to call) :


      soustitrage_txt.text = _global.myData.phrase2;


      And now it shows me "undefined"... :/


      Here's a preview of my external text file (I translated it...since it's in French normally) :


      phrase1=Hello and welcome to this guide that will show you how to adjust your workstation step by step.&
      phrase2=Adjusting your workstation properly will prevent you from having any discomfort that may result from bad posture or improper adjustment.&


      (and so on...)


      Thanks a lot!