6 Replies Latest reply on Nov 20, 2009 3:33 AM by Piyush kathayat

    problem with TextSnapshot class

    Varun Upadhyay Level 1

      can any one help me. I m stucked on this problem. I am not able to highlight text at second click. it's not reassign when i m trying to clear it next time. to check exiting problem please enter "hot" in text box and click on button , you ll see highlighted text. but next time whent you try to click on that it ll not show any result.

       

      please help me it's very urgent....

       

       

      var my_snap:TextSnapshot;

      s1.onRelease = function() {
      my_snap = odd_img.getTextSnapshot();
      hltextodd(st.text,my_snap);
      };
      //******************set focus***************
      hltextodd = function (txt:String, snap:TextSnapshot) {
      var fnd_arr = new Array();
      var start_pos:Number = 0;
      start_pos = snap.findText(start_pos, txt, true);
      found = 0;
      while (start_pos>0) {
        found = found+1;
        fnd_arr[found] = start_pos;
        var finalB:Number = start_pos+txt.length;
        snap.setSelected(start_pos,finalB,true);
        trace(start_pos+', '+finalB);
        start_pos += txt.length;
        start_pos = snap.findText(start_pos, txt, false);
      }

      };

       

      to run this script add a  input text in stage with name "st" and button with "s1" and a movie clip having static text "TextSnapshot Example, TextSnapshot Example,TextSnapshot Example,TextSnapshot Example,TextSnapshot Example,TextSnapshot Example,TextSnapshot Example,TextSnapshot Example,TextSnapshot Example,TextSnapshot Example, TextSnapshot Example, TextSnapshot Example"

       

      Please help .. it's urgent. ..

       

      thanks in advance.