html text on Attribute

  • arakno
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: Lisboa

Post 3+ Months Ago

I tried everything and can-t this thing to work. I have this xml:

Code: [ Select ]
<menu nome="Projectos">
    <item projn="102" nome="Casa de Praia Angola" msg="Edifício de Habitação em Algés Loteamento <b>Bombarda</b> 42-6ºC<br /> 6" />
    <item projn="103" nome="Complexo no Huambo " />
</menu>
  1. <menu nome="Projectos">
  2.     <item projn="102" nome="Casa de Praia Angola" msg="Edifício de Habitação em Algés Loteamento <b>Bombarda</b> 42-6ºC<br /> 6" />
  3.     <item projn="103" nome="Complexo no Huambo " />
  4. </menu>


Then in Flash i read it to a textfield

Code: [ Select ]
messagetxtmc.message_txt.html = true;
messagetxtmc.message_txt.multiline = true;

function displaytag(msg) {
    messagetxtmc.message_txt.htmlText = msg;
}
  1. messagetxtmc.message_txt.html = true;
  2. messagetxtmc.message_txt.multiline = true;
  3. function displaytag(msg) {
  4.     messagetxtmc.message_txt.htmlText = msg;
  5. }


and I need the attribute msg to be html rendered so I can display it in the textfield.
I tried encapsulating it with CDATA and also tried to write in html entities with no luck.
I hope I dont have to use php , i would be more than happy withg a quick and simple fix for this.

:D

Any suggestions?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

instead of the open/close tags, place open/close brackets so flash can read the xml. Then, in flash, replace back the brackets with the tags.
i.e.: in xml:
<b>Bombarda</b> 42-6ºC<br />
becomes
[ b ]Bombarda[ /b ] 42-6ºC[ br / ]
And in flash, replace [ with < and ] with >
This should do the trick.
  • arakno
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: Lisboa

Post 3+ Months Ago

great Icecold! kind of a hack but I think it will work
Thanks
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

Another option would be to use simple text files, config like structure.
But for that you will need to create your own parsing system.
  • arakno
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: Lisboa

Post 3+ Months Ago

No need to. Your previous suggestion worked great!

Im parsing each attribute with this neat little function i found on actionscript.org:

Code: [ Select ]
function searchReplace(block:String, find:String, replace:String):String {
    return block.split(find).join(replace);
}
  1. function searchReplace(block:String, find:String, replace:String):String {
  2.     return block.split(find).join(replace);
  3. }


thx for the help

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 4 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.