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.
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.
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.
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?
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.
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?