9 Replies Latest reply on May 16, 2007 7:28 AM by kglad

    replace letter by movieclip ?

    chrisatflash Level 1
      Hello,
      Does anyone know how to replace a letter or letter combination like in a chat, to replace this letters and
      put a movie clip instead?

      I tried something like this, but got no result.

      textfield_txt.text = "After this word a " + smile + "smile should be visible..";

      I made a movieclip with an identifier link 'smile" ..put this method does not work.

      Does someone know another option?

      Regards,

      Micheal.
        • 1. Re: replace letter by movieclip ?
          dr_ross Level 1
          i take it smile is the instance name of the movieclip you wish to use. Just refference the _name property of the movieclip.
          i.e.

          textfield_txt.text = "After this word a " + smile._name + "smile should be visible..";

          if you wanted something else from the smile movieclip instead of its name, than you'll have to be a little more descriptive.

          Dr Ross,
          • 2. replace letter by movieclip ?
            MurMeeKeer Level 1
            No. Micheal is expecting the entire movie clip to be displayed in the text field.

            Like this.

            I think it is not possible.
            • 3. Re: replace letter by movieclip ?
              dr_ross Level 1
              You know i'd never have thought anyone would try that.

              MurMee's right, its not possible using a standard TextField, you could make your own component/class that splits the string at predefined characters , :) ;) :D etc and render out the string in pieces, TextField-MovieClip-TextField-Movieclip inside one MovieClip
              • 4. Re: replace letter by movieclip ?
                chrisatflash Level 1
                Too bad.. i wanted to create a input textfield ..like a chat.
                But it seems not possible. :(
                • 5. Re: replace letter by movieclip ?
                  kglad Adobe Community Professional & MVP
                  you can add movieclips to html textfields use the movieclips linkage id and an src tag. however, it's difficult to control the positioning of the movieclip.

                  the most satisfactory solutions are to use a custom font that contains your smiley. that you can position precisely.
                  • 6. Re: replace letter by movieclip ?
                    Damon Edwards Level 3
                    make it a dynamic text field. and say you name it "text_txt". then open up a text editor and type out your sentence like this &start=After this word a&smile=www.linktosmile.com&aftersmile=smile should be visible.
                    then in your flash doc, in an actions layer above your dynamic text filed (text_txt) write
                    var textVar:LoadVars = new LoadVars();
                    textVar.load("nameoftextfile.txt");
                    textVar.onLoad = function(){
                    _global.dyn1 = (textVar.start);
                    _global.dyn2 = (textVar.smile);
                    _global.dyn3 = (textVar.aftersmile);
                    text_txt.html = true
                    text_txt.htmlText = dyn1+"<img src=\""+dyn2+"\"/>"+dyn3
                    • 7. Re: replace letter by movieclip ?
                      chrisatflash Level 1
                      Hi dzedward ,

                      I tried your example.. but the smile.gif will still be placed on the next line and not between
                      the words. I wonder how they do it in some flash chat applications..

                      And i also tried the linkage id and an src tag.. but it will not be positions between the words..

                      • 8. Re: replace letter by movieclip ?
                        Damon Edwards Level 3
                        hows that possible if its sandwiched between the 'start' and 'aftersmile'... maybe you need to extend you text field a little.. if its not long enough to fit a small sentence, then its not long enough. or maybe you need to get rid of the background of the smiley, make it transparent. all i know is it shouldnt be putting it on the next line if you use the script i gave.
                        • 9. Re: replace letter by movieclip ?
                          kglad Adobe Community Professional & MVP
                          you can't control precise positioning using the src tag, especially when you fail to use a linkage id for the movieclip and load the image from an external source as in dze's code.

                          again, the most satisfactory solutions are to use a custom font that contains your smiley. that you can position precisely.