A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: AS3 does not interpret HTML into XML

  1. #1
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81

    AS3 does not interpret HTML into XML

    hello!

    the title is auto explanatory. this doesn´t work,
    it shows plain text, not formatted:

    xml:
    Code:
    	
    <image link="slides/pic2.jpg" title="Título">
    		<desc>
    			<![CDATA[<font color='#"+990000+"'><b>First line Text in Bold Red color</b><font>]]>
    		</desc>
    	</image>
    as3:
    Code:
    descriptionTF.htmlText = my_items[intCurrentSlide].desc;
    thanks !!

  2. #2
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    This may seem a bit unorthodox but I use xml everyday and this works for me. Just take out your CData

    Code:
    <image link="slides/pic2.jpg" title="Título">
    		<desc>
    			<font color='#990000'><b>First line Text in Bold Red color</b><font>
    		</desc>
    	</image>
    Hope this helps. Let me know if it doesn't and I'll look further into it.

  3. #3
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81
    hey fellows, I´ve got it to work using it like this:
    Code:
    		<desc>
    			<![CDATA[O Floripa Music Hall traz a maior banda de heavy metal do Brasil. Ingressos ja a venda <font color='#990000'><a href='www.google.com'>Saiba mais</a></font>]]>.
    		</desc>
    but the tags <b> as well as <strong> don´t work !
    i wonder why..
    thankS!

    Thanks!

  4. #4
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81
    hey jweeks123, thjanks for answering,

    I took of the [[CDATA like this:
    Code:
    	<image link="slides/pic1.jpg" title="Descubra o Floripa Music Hall">
    		<desc>
    			O Floripa Music Hall traz a maior banda de heavy metal do Brasil. Ingressos ja a venda <font color='#990000'><a href='www.google.com'>Saiba mais</a></font>.
    		</desc>
    	</image>
    and it not only doesn´t interpret the html at all, but it also shows a blank line in the textfield, before the text..

    like i posted previously, with the "CDATA" i´ve managed to work the 'font' and 'a' tags, but not the 'b'.

    Thanks !

  5. #5
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Interesting. Well, do you get the correct HTML string when you trace out the nodes value?

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81
    trace shows:


    O Floripa Music Hall traz a maior banda de heavy metal do Brasil. Ingressos ja a venda <b><font color='#990000'><a href='www.google.com'>Saiba mais</a></font></b>.


    funny...

  7. #7
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Very Interesting Indeed.

    If I make a textfield and set its text to that, it works as it should for me. Perhaps yours is getting reset somewhere? Perhaps a textformat is interfering? Not sure, but another idea would be to load that string into a string variable and then assign it to the textfield as HTML text.

  8. #8
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81
    that shows the same results as before :

    Code:
    			var descString:String = my_items[intCurrentSlide].desc;
    			
    			if (descriptionTF)			
    				descriptionTF.htmlText = descString;
    and there is no text format..

    textfield settings in flash ide:

    anti alias for animation , render text as html, embedded characters, multiline...

    tried with other settings (device fonts, etc) and Arial , tag <strong> instead of <b> in the xml file...no success!
    really intriguing !

  9. #9
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Hmmm...I wonder if it's your flash player. Sometimes I see different flash results on different machines. Do you have a source file you could attach so I may see what I get with it?

  10. #10
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81
    sure, how could I send it to you ?

  11. #11
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Shoot me an email if you'd like. jonathon.weeks@gmail.com

  12. #12
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81

  13. #13
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    I actually need your entire source,
    the xml
    fla
    and swf if you could.

  14. #14
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81
    sorry, i had sent only the swf by mistake. i´ve sent it to ur mail

  15. #15
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    It's all good. I've got it, and made some changes. I've sent you a new source compilation, but I'm thinking the problem lays within the font that your using on the textfields themselves.

  16. #16
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    Cmon fellas, leavin me outta the loop!

    Attach is there for a reason ziriguidum
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  17. #17
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    LOL, you didn't miss much Phix. Our statements here pretty much sum it up, but in the end ziriguidum ended up removed the <b> tag as it wasn't working well unless device fonts were in use.

  18. #18
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    Long as it got solved.

    Just givin' you hell
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  19. #19
    Senior Member jweeks123's Avatar
    Join Date
    Mar 2006
    Posts
    1,124
    Nothing wrong with a bit of hell raisin, LOL.

Tags for this Thread

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