Customizing the way XML is transfered into flash file

I am loading an XML document into a flash file.
</slideNode>
  <slideNode jpegURL="images/prizes/prize2.jpg">Prize 2</slideNode>
  <slideNode jpegURL="images/prizes/prize3.jpg">Prize 3</slideNode>
  <slideNode jpegURL="images/prizes/prize4.jpg">Prize 4</slideNode>
  <slideNode jpegURL="images/prizes/prize5.jpg">Prize 5</slideNode>
</Slides>

The text in each record go into a dynamic text field in the fla document. how can I customize the output of the text? Can I put html tages in between the xml tags?
what if I want for example, the word prize to be italicizes and the number to be bold, or something like that?
rivkamakAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DesignbyonyxCommented:
You can certainly use HTML formatted code in your node values, but they must be encoded:

<i>Prize</i> <b>2</b>

is the html encoding for:

<i>Prize</i> <b>2</b>

You can find tools out there that will encode a string for you:
http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx

You must also enable html (and/or set the htmlText property for the text field)

Let me know if that helps.

~Ryan
0
DesignbyonyxCommented:
HaHa, so Expert's Exchange decoded my encoding... probably for security purposes.  Just go to the url I provided and paste the html code from above... you will see the format it needs to be in.  You know it's right when you can't hardly read it.
0
Aneesh ChopraCommented:
I have better solution:

we can have HTML code in XML without any encoded, it just need to be written using CDATA tag.

here is a working sample with source files:
http://www.4shared.com/account/file/13574307/5d156978/html_data_through_XML.html
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Aneesh ChopraCommented:
here is the link again (in case above link does not work):
http://www.4shared.com/file/13574307/5d156978/html_data_through_XML.html
0
rivkamakAuthor Commented:
I'm attaching my code. yet it doesn't show html formatted in my flash file.
http://www.oorah.org/auction/2009/prizes/gallery.html
yet, something must be happening becuase it isn't displaying the tags.

	<description><![CDATA[<p>Sleek, smart and packed with features, this computer package is ideal for home or office. Maximize your efficiency while your donation helps Oorah maximize our children&rsquo;s yeshiva educations, providing support through tutors, homework help and family mentors.</p> <p><strong> DELL COMPUTER:</strong> Quad Core Intel Xeon processor and Windows Vista  offer unmatched speed and ease. Graphics &ldquo;pop&rdquo; on 20&rdquo; inch ultra flat panel screen.<br> <br><strong>DELL LASER PRINTER</strong>: Dell&rsquo;s 5310 is the ideal network printer, handling 50 pages per minute at up to 1200x1200 dpi. Easy to read menus and large LCD display.</p>]]></description>

Open in new window

0
Aneesh ChopraCommented:
it also depends how you parse the XML,
you may review code in the sample provided above.

if still not clear,
I suggest to attach your sample source for review and quick fix

0
DesignbyonyxCommented:
Make sure that you are embedding the font properly, and make sure you are embedding the bold version of the font as well.

What I usually do is create a dynamic textfield off the stage and I put text in there that has every font I want to use in the movie.  Then in the properties panel I embed the fonts for that text field.  Those fonts are then available for any textfield in my movie (provided I say myTextField.embedFonts = true).

If you use this method for embedding fonts, it is important to put every combination you plan on using (normal, bold, italic).  For example, I usually type in ABC - keep the A normal, make the B bold, and make the C italic.  I do this for every font I want to use in my movie.  

Take care.
~Ryan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rivkamakAuthor Commented:
When the XML gets transfered into my flash file, my ' get changed into &apos and other & becomes &amp.
How can I program it so that it stays the way I type it?
0
DesignbyonyxCommented:
Try escaping those special characters by preceding them with a back slash (\&, \', etc.)
0
rivkamakAuthor Commented:
I tried fixing the line with a slash like this  <header>38. Man\'s Wardrobe</header>
and the result i get it this  :38. Man\&apos;s Wardrobe
0
rivkamakAuthor Commented:
Also, when I put bold like this: <b>Canon Camera</b>
it boldes the text but adds a , to the begining and end
,Canon Camera'
0
DesignbyonyxCommented:
Hmmm.  I have to admit that I have not really done the whole trial and error thing with XML and CDATA, but every time I store html data in an xml file, I store the encoded html (as I mentioned in my first post)... and I have never had any formatting or weird-character issues like you are having.  I wish I could give you the answer you are looking for.  If you send me a zip with your files (or an example scenario with a simple text field, your XML file, and the EXACT code you are using), I'd be glad to take a look at it... it would be a good thing for me to know.

ryan [dot] wheale [at] gmail [dot] com

Please try and make your files work "right out of the box"... meaning I want to be able to open the flash file (or test it on my localhost) and see your problem without having to download any special class files, components, or troubleshooting flaws in your code that don't have anything to do with the matter at hand.  Please include any SQL files if your site uses a database, or MXP files for custom classes or components.  The last guy I helped I had to go to some website and download a tweening class that he used when he could have just included it in the zip he sent me.  Another guy created an "example" file but left out crucial code because he didn't think that the code was relevant.  It just makes things harder on me and it is not a good motivator for helping other people.  (I don't mean to come across as abrasive).  
Thanks.

~Ryan
0
DesignbyonyxCommented:
And feel free to use this as a sort of hack, if you want to keep moving forward without waiting for me.  Simply call this function and pass your text to it.
myTextField.htmlText = rebuildHTML( textFromXML );
 
function rebuildHTML(theText:String):String {
   var tempText:String = theText;
 
   tempText = tempText.split("&lt;").join("<");
   tempText = tempText.split("&gt;").join(">");
   tempText = tempText.split("&amp;").join("&");
   tempText = tempText.split("&quot;").join("\"");
 
   return tempText;
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.