1 Reply Latest reply on Jan 2, 2009 3:32 PM by chopTheWood

    still trying to Select text

      I have a "textStyler.swf" loaded into the movieclip "styler_mc" which is on the main movie "editor.swf".

      The objective is to highlight some text in an input text field called "edit_txt" which is also on the main movie "editor.swf" and to replace it with some other text

      The following code (located on the "textStyler.swf"):
      _level0.edit_txt.text = beginTag+_level0.edit_txt.text+endTag;

      works fine to reference and replace some text in "edit_txt" on the main movie as long as it doesn't include having to read some selected text.

      However, sometimes I want to replace some text in "edit_txt" that the user has selected with some other text. The problem is that I haven't been able to get anything but "-1" as the result for the following code:

      var char1:Number = Selection.getBeginIndex();//first character index of selected text

      var charLast:Number = Selection.getEndIndex();//first character index of selected text

      (both return -1) no matter what text is selected. I've tried to use _level0.Selection.getBeginIndex() AND _root.Selection.getBeginIndex()but that doesn't work either. So how is it that "textStyler.swf" can reference "edit_txt" and change the text but Selection class doesn't see it?
        • 1. still trying to Select text
          chopTheWood Level 1
          Well, now I know why my problem went unanswered for two months. Probably, nobody could recreate the problem and wrote me off as wacko -I would have. I discovered other weird things happening to my file like getting hundreds of compiler errors in one mouse click (every so often) so I decided (with kglad's suggestion) to move all my assets to a new .fla file... Yes , a corrupt .fla it was I did that and suddenly.. new life with discovery that .Selection works fine now. Two months (part time) on this issue! So, now I wonder: Is there a software utility that can detect and maybe repair broken .fla files??