A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Attaching emoticons to dynamic text?

  1. #1
    _root.username+"ns";
    Join Date
    Apr 2008
    Posts
    19

    Attaching emoticons to dynamic text?

    Hey guys, I am clueless about how to even go about attempting this. I have a combat log for a game, and I want various damage element types to be preceded by a small icon representing the type before the text displaying damage done is displayed. How, if at all possible, can you attach small icons to dynamic text so they scroll together and are aligned properly?

    I've read about TLF but some of the methods there seem so much more confusing than they need to be. Any tips?

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You are right, dynamic classic textfields are bad at displaying inline graphics, it can be done though and TLF is far superior for doing it.

    Heres an example of loading in an external icon and one from the library.

    On my hobby site I have a section where I use it, fruitbeard.net choose "shout" and then mess around with creating a shout and previewing it, thats if you look.

    Hers a link to the TLF method, http://taskinoor.wordpress.com/2011/...out-framework/
    Heres the normal file

  3. #3
    _root.username+"ns";
    Join Date
    Apr 2008
    Posts
    19
    So this method is definitely more confusing than simply say, using an <img> tag. But, it seems do-able! My last question is, can I use htmlText with these spanElements? As, where it says "spanBefore.text", can I have spanBefore.htmlText = "<font color> etc etc etc"?

    Thanks for the help!

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    perhaps you should look at my file

    but yes you can use coloured text etc

    swap one of the lines for this

    multiText.appendText("<img src='1.png' vspace='1' hspace='0' width='16' height='16' /> <font color='#ff0055'>I am</font> Image\n");

    if you do go for TLF text then you will need to cahnge the actionscript settings also

    ActionScript Settings -> Library path -> Default linkage ... Merged into code
    Last edited by fruitbeard; 08-30-2014 at 11:44 AM.

  5. #5
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    perhaps you are reluctant to download the file, well here is another one which involves the tlf textfield, please say if you downlaod it, I will leave it for one week or until you grab it, whichever comes sooner.

    http://fruitbeard.net/uploaded/text.zip

    You could probably always use a scrollpane and arrays to do your stuff, no idea how you have your file
    Last edited by fruitbeard; 08-30-2014 at 12:19 PM.

  6. #6
    _root.username+"ns";
    Join Date
    Apr 2008
    Posts
    19
    Hey I downloaded your file but when I test the movie there are no actual images displayed, except on the very last line where a box is displayed. Can't replicate it because it's not displaying for me

  7. #7
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    hi,

    Well they both work here

  8. #8
    _root.username+"ns";
    Join Date
    Apr 2008
    Posts
    19
    Hey this is all I see.

    What could be causing a difference between your end and mine? I'm using Flash CS6.

  9. #9
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You need the 1.png, that was inside the zip also

  10. #10
    _root.username+"ns";
    Join Date
    Apr 2008
    Posts
    19
    Oh, I'm dumb.

    So it works perfectly in your document, but when I copy and paste your exact code and named Dynamic Textboxes, the text displays but the images no longer appear. I have imported both 1.png and box.png and made sure their linkage identifiers are accurate, but they do not appear in my text - just a blank space where they should be.

    Here is my exact code, slightly modified from yours.

    Code:
    if (minutes < 6)
    		{
    			switch (sillySeed)
    			{
    				case 0 :
    					logMC.logTxt.htmlText +=  "<font color='#FFFFFF'>- " + charName + " is eager to continue the adventure.</font>\n";
    					break;
    				case 1 :
    					logMC.logTxt.htmlText +=  "<font color='#FFFFFF'>- A magical fairy appears before " + charName + " and offers a multitude of free loot, but " + charName + " spammed through the menu prompts too quickly and declined the offer.</font>\n";
    					break;
    				default :
    					logMC.logTxt.htmlText +=  "<img src='box' vspace='3' hspace='0' width='16' height='16' /><font color='#FFFFFF'>- " + charName + " comes across a trading caravan, but they appear to be out of anything useful. They say they will have better items once " + gender1 + " is a higher level, which seems stupidly convenient to " + gender2 + ".</font>\n";
    			}
    		}
    I tried the image on the third case using your box MC, but it won't attach.

  11. #11
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Attach your fla, or a simplified version, box is the one tht is inside my fla library, the ying yang is the external image, so you might need the box movieclip from my fla

    you can attach a movirclip from the library using its AS linkage name, which box is
    Last edited by fruitbeard; 08-30-2014 at 01:59 PM.

  12. #12
    _root.username+"ns";
    Join Date
    Apr 2008
    Posts
    19
    Alrighty, attached my .fla so far. Actions are in the last Scene, first frame.

    https://dl.dropboxusercontent.com/u/...39/Testing.fla

  13. #13
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I'm not sure if you should use scenes really, I'm sure you will come into trouble sooner or later, but it's your choice.

    It's slightly messy too amongst other things, I can get it to work by using the external image, but I'm not sure how that affects the airios functionality etc etc as I dont produce stuff for that

    http://fruitbeard.net/uploaded/desktopper.zip

    tlf text http://flashthusiast.com/2010/05/05/...and-flash-cs5/
    Last edited by fruitbeard; 08-30-2014 at 03:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center