11 Replies Latest reply on Apr 7, 2007 8:59 AM by kglad

    Smileys in Textarea

    Hope1983
      Hellow
      i don't know if i can write in German so i wrote in English( its not very well :) )
      I think the title says my problem. I want to join smiley in my textarea. But there is a Problem with flash 8 pro!

      this Code:


      var newChat:String = so.data.chatMessage;



      newChat = newChat.split('88').join('<img src="cool.gif">');

      chattext.text = newChat ;

      i want instead of "88" the smiley cool.gif. If i give a link , the smiley is shown in next line, like this:

      here i want :) and
      then cames

      here i want and
      :)

      Another question would be, if i can join a movieclip instead of a image from a url...
      the i could load all smileys into the library.....

      thanks
      Hope
        • 1. Re: Smileys in Textarea
          kglad Adobe Community Professional & MVP
          positioning graphics in flash textfields is always a problem. especially when loading an external graphic whose dimensions can't be determined by flash until loading is complete and text has already been placed in the textfield.

          using width and height parameters in the img tag helps. but it's usually necessary to make use of line breaks and empty spaces to position graphics exactly.

          you can use a movieclip in a textfield by assigning it a linkage id and using that id as your src parameter.
          • 2. Re: Smileys in Textarea
            Hope1983 Level 1
            How i can make a link to the object in the library?

            Must it be a Movieclip or can it also be a Bitmap?

            I have one bitmap in the library named "cool.gif" and if i write: <img src="cool.gif"> the programm crashes.

            Can you explain me how to make a link in the textfield to a component in the library?

            thanks
            • 3. Re: Smileys in Textarea
              kglad Adobe Community Professional & MVP
              :

              • 4. Re: Smileys in Textarea
                Hope1983 Level 1
                Ok now i understand how to link to them. But it doesnt work..
                the mc also comes in the next line. Is there a Method to preload the clip and then place it there instead of the string?


                • 5. Re: Smileys in Textarea
                  kglad Adobe Community Professional & MVP
                  no, you can't preload the image and then add it to a textfield.

                  you can import the image to your fla, convert it to a movieclip and then use its linkage id.

                  if "...it doesn't work..." it's because of an error on your part.

                  you'll need a multiline html-enabled textfield and you'll need to use the correct code and you'll need to have the linkage id assigned for a movieclip.
                  • 6. Re: Smileys in Textarea
                    Hope1983 Level 1
                    Yes of course it would be a error in my part.... BUT

                    i have done this what you say..
                    textfield (multiline and html enabled )
                    movieclip with the link id
                    img tag with the id as src...

                    and its the same fault:
                    smiley apears on next line....
                    Ive find in the help of the Flash that it's not working !

                    So i must do it on the other way?

                    how i can get the x and y positions of a string in a text?
                    And then put the movie clip on this positions ?

                    Thanks for help
                    • 7. Re: Smileys in Textarea
                      kglad Adobe Community Professional & MVP
                      oh, if you're smiley's appearing it IS working. as i mentioned in my first message above, positioning your smiley is always a problem with flash.

                      and, as i mentioned, using width and height parameters in the img tag helps. but it's usually necessary to make use of line breaks and empty spaces to position graphics exactly.

                      • 8. Re: Smileys in Textarea
                        Hope1983 Level 1
                        Can you give me an example please?
                        i have mak my image the smallest one width="1" heigth="1" but its also in the next line.
                        i have tried a lot of brakes and spaces,, its the same at all.

                        I think i must get the x and y coordinates of the string like "88" and then replace the movieclip on it..
                        But how i can do that?

                        Another question is,.. if they are stay at the same position in the textfield or if they also scroll with the textfield
                        • 9. Re: Smileys in Textarea
                          kglad Adobe Community Professional & MVP
                          what are the dimensions of your image? what are the dimensions of the textfield and what text do you want to appear before the image and what text do you want to appear after the image?
                          • 10. Re: Smileys in Textarea
                            Hope1983 Level 1
                            Textfontsize is 12
                            Image size is 10*10
                            The Code to change the string into tag:
                            newChattext = newChattext.split(':)').join('<img src="MovieClipID">');


                            I only want to set smileys instead of the " :) " for example.
                            But if i write this it comes on the next line what ever i am doing !
                            Like this:
                            im wrting

                            You're nice :) tell me something about you

                            the outcome on textfield is like this:

                            You're nice <space> tell me something about you
                            :) ( its the movieclip but on the wrong place!)

                            And this should not be.
                            ----->
                            Sooo i want to get the x and y variable on the textfield of the string ":)" and set
                            the movieclip in this postition of the clip.
                            I hope now i could explained my problem.
                            • 11. Re: Smileys in Textarea
                              kglad Adobe Community Professional & MVP
                              there are all sorts of problems positioning objects (other than text) in flash textfields. i don't know any general solution.

                              in particular, positioning an object on the first line of text, when it's not at the beginning, is difficult or impossible.