movieClip in a dynamic textbox

I am writing a flash project and am entirely lost on how to include a movieclip in a dynamic textbox? Is this possible, if so how? An example of what I am trying to accomplish is a chat client that has the text replaced with a smiley.

Anyone have any idea how to get this to work?

-matt

You can’t just place a movieclip inside a textbox of any kind. You could, however, create a movieclip and inside THAT movieclip, you’d put your textbox and your other movieclip but it’s not possible to put a movieclip actually inside a dynamic textbox.

Thank you for your quick repsonse.

Ok then assuming my previous question is not possible. How would I go about writing a smiley function for dynamic text?

I basically want to write a search and replace that will take a : ) and turn it into a smiley graphic. Any ideas or resources that could help me out?

-matt

Hmmm… I’m not aware of any resources for this and I’m a little bit of a loss I’m afraid! I’ve got a lot of ideas but you’ll run into problems with them I’m sure.

If you’re still interested though, here’s what you could do…

Create a movieclip that has a “onClipEvent (enterFrame)” event so the code inside keeps constantly repeating itself. That code would check to see if the last two characters in your textfield were “:)” and if so, remove them and attach a movieclip that would presumably contain your smiley face.

Functions you would need to use for this solution might be…
attachMovie
subStr

Sorry I couldn’t be of more help but good luck! Sounds like a complicated project!

I am working out the search and replace issue, but how would i go about placing this smiley so it looks inline? For instance in the middle of the message.

thank you

-matt

Yeah, that’s the problem I thought you’d run into and to tell you the truth, I’m not entirely sure! If you could find out the position (in pixels) of where the cursor is when the “:)” has been detected, you could just use a line like this…


attachMovie("smiley","smiley",1);
smiley._x = //THE XPOS OF THE CURSOR
smiley._y = //THE YPOS OF THE CURSOR

Again though, I’m not sure if it’s possible to find out the position of a text cursor relative to the stage. Sounds like you might need to start a serious google-session!

hmm… I am so lost on this one. I am not aware of the ability to find the pos of the cursor. Is there a way to write the string and then search it. Find the place where the : ) is, and place a smiley face above it on another layer?

Give me a minute mate and I’ll get back to you. I gotta give this some thought…

how about taking a smiley font… then doing a string search and replace and inserting the appropriate smiley symbol?

@3rdeye
good suggestion but i need it to be really slick graphics in full color. like the smilies on Kirupa.

-matt

Sorry mate, I’m tired out (it’s 2:50AM here!).

It looks like you CAN embed images in a textfield. Check out “Using HTML in textfields” in Flash’s help and, in particular, the “Render text as HTML” option in the property inspector for the textfield.

I’ve done what the helpfile said but for some mad reason, it ain’t workin. I think I’m just too tired and I’m missing something stupid.

Couple of things to remember though–for this to work, your textfield has to be set to Multiline (with wrapping) and you can only use either SWFs or JPEGS. I also think that you can’t use progressive JPEGS.

Good luck and let me know how you get on,
Dave

ok thank you goodnight. I will catch up with you tomorrow.

-matt

well HTML image tags will work, but aligning them is impossible… as far as I can tell… how come a custom font has to be black and white? or un animated… must be some stupid IEEE standard or something?

Um… I think a font can be a solid color, but am not aware as to whether or not it can have animation to it? I don’t think it can.

-matt