3 Replies Latest reply on Nov 30, 2012 9:22 AM by mr.alexblah

    Proper way to load variable text into a text field from inside a function AS2

    mr.alexblah

      First of all much thanks to KGLAD for giving me some extra tips on how to use FUNCTIONS, but while digging dip on AS2, functions, text fields and such. I came accros this, this is my AS2:

       

      var title1:String = "extra";

      var message1:String = "1-2";

      var sub1:String = "hello";

       

      b1.onPress = mb1.onPress = function() { moves("1")};

       

      function moves(num) {

      title.text = ["title"+num]; <------ a variable thats defined in the above code,when b1 is hit, it will load what ever is on title1

      message.text = ["message"+num];

      sub.text = ["sub"+num];

      }

       

      I was doing some test and something like whats above WORKED PERFECTLY. i ht button b1 and loads the text right and I was doing some more adding to the funciont NOW IT DOESNT WORK, for some STRANGE reason it will only load one text field if I use this code:

       

      function moves(num) {

      title.text = ["titulo"+num];

      message.text = horario1;

      sub.text = mensaje1;

      }

       

      which is EXACTLY the same (to my eyes) as the one thats suppose to work, I've already spent couple of hours and a few beers (to calm my frustration) to understand WHY it doesnt work. I usually go on and on until I find the solution but now I feel stuck, hope someones knows