# Best way to attach smileys into textfield?

**URL:** <https://forum.kirupa.com/t/best-way-to-attach-smileys-into-textfield/132430>\
**Category:** Uncategorized\
**Created:** [December 28, 2004, 4:33pm UTC](https://forum.kirupa.com/t/best-way-to-attach-smileys-into-textfield/132430 "2004-12-28T16:33:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voccart](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@Voccart](https://forum.kirupa.com/u/Voccart)\
**Post date:** [December 28, 2004, 4:33pm UTC](https://forum.kirupa.com/t/best-way-to-attach-smileys-into-textfield/132430/1 "2004-12-28T16:33:35Z")

</div>

hi guys, back again with a question :-)…

I did create a flash shoutbox (php & mysql) and its working like a charm…  
now i want to add smileys. users can press on a smiley to attach it to the message. i got the flash smileys in the library.

i know its going to be hard to implement that feature into the shoutbox…  
my question is:  
wich is the best way to do this?

For instance, let’s say i want to display this string :

“ **Now im very happy** \<SMI\>: D\</SMI\> **and now im not** ”

1. 

when shoutbox message is loaded into flash, parse it to find the \<SMI\>: D\</SMI\> markup, then analyse it to know what smiley to display. Let’s say i want to replace “: D” by an mc called “smi\_laugh”. Then split the string into three parts :  
[list=1]  
[_]“Now im very happy”  
[_]\<SMI\>: D\</SMI\>  
[\*]“and now im not”  
[/list]then replace \<SMI\>: D\</SMI\> with the smiley instance from the library and put it all back into textbox… new string = 1(txt) + 2 (smi\_laugh\_mc) + 3(txt)  
(whooaaa, lots of work but okay :-))

OR

1. 

load the same stuff into flash and create a extra mc on top of the texfield and attach the smileys to it to display…fill the textfield with spaces to make spce for the smiley.

lol , i hope this make any sence…

thanks
