# PHP, XML and Flash displaying HTML

**URL:** <https://forum.kirupa.com/t/php-xml-and-flash-displaying-html/240876>\
**Category:** programming\
**Created:** [October 7, 2007, 6:12pm UTC](https://forum.kirupa.com/t/php-xml-and-flash-displaying-html/240876 "2007-10-07T18:12:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaplanyo](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@kaplanyo](https://forum.kirupa.com/u/kaplanyo)\
**Post date:** [October 7, 2007, 6:12pm UTC](https://forum.kirupa.com/t/php-xml-and-flash-displaying-html/240876/1 "2007-10-07T18:12:18Z")

</div>

I’m very close to having a version of the claudio scroll that uses XML output, but I’m having trouble with the \< and \>. I’d like to have some links or bold in the text, but getting Flash to play nice has got me.

Any advice for how I can start with Flash friendly XML output? I’ve tried a couple different approaches. The version that gives me the XML source with \<b\>'s ect… drops out in Flash. I thought that’d be the best one.

Here’s what i’ve tried in my php:

```php
echo "<xml>
";
while ($row = mysql_fetch_assoc($result)) {
echo "	<Event dates=\"".htmlentities($row['event_date'])."\" titles=\"".htmlentities($row['event_title'])."\">".htmlentities($row['event_text'])."</Event>
";
}
mysql_free_result($result);
echo "</xml>";  

```

When I remove the htmlentities from the event\_text, I get the ‘\<’ instead of the \< but then the text in Flash disappears after that tag.

Here’s a snippet of my as:

```auto
var eventXML:XML = new XML();
eventXML.ignoreWhite = true;

var datesArr:Array = new Array();
var titlesArr:Array = new Array();
var eventTextArr:Array = new Array();

var fmt1:TextFormat = new TextFormat();
fmt1.font = "Bodoni Book";
fmt1.size = 13;
fmt1.color = 0x333333;
fmt1.letterSpacing = .3;

eventXML.onLoad = function(bSuccess:Boolean):Void {
	if (bSuccess) {
		var eventsArr:Array = this.firstChild.childNodes;
		//	trace(eventXML);
		trace("event text array here = " + eventXML.firstChild.firstChild.toString());
		trace("number of event entries = "+eventsArr.length);
		
		// variable for holding the height of the attached clips
		var hHolder:Number = 40;

		for (i=0; i<eventsArr.length; i++) {
			// get the xml content and store it in appropriate arrays
			datesArr.push(eventsArr*.attributes.dates);
			titlesArr.push(eventsArr*.attributes.titles);
			eventTextArr.push(eventsArr*.firstChild);
		}
		var eventCount:Number = eventsArr.length;
		var p:Number = -1;
		for (m=1; m<=eventCount; m++) {
			p++;
			trace("holder = "+hHolder);

			// create clips in the empty container based on the number of event entries
			eventContainer_mc.attachMovie("eventTextClip","eventEntry"+p+"_mc",p);

			// fill the containers with content
			eventContainer_mc["eventEntry"+p+"_mc"].dates.text = datesArr[p];
			eventContainer_mc["eventEntry"+p+"_mc"].titles.text = titlesArr[p];

			eventContainer_mc["eventEntry"+p+"_mc"].eventText.htmlText = eventTextArr[p];
			eventContainer_mc["eventEntry"+p+"_mc"].eventText.html = true;
			eventContainer_mc["eventEntry"+p+"_mc"].eventText.setTextFormat(fmt1);
			eventContainer_mc["eventEntry"+p+"_mc"].eventText.autoSize = true;
			
			trace(eventContainer_mc["eventEntry"+p+"_mc"]._height);
			eventContainer_mc["eventEntry"+p+"_mc"]._x = 70;
			eventContainer_mc["eventEntry"+p+"_mc"]._y = hHolder;
			hHolder += (10+(eventContainer_mc["eventEntry"+p+"_mc"]._height));

			// Set the height variables for use in the scrolling function top = eventContainer_mc._y+5;
			bottom = eventContainer_mc._y + copy_mask._height - eventContainer_mc._height - space;		
		}
	}
};

```

here’s my online examples  
[http://www.workalicious.com/event\_output\_xml.php](http://www.workalicious.com/event_output_xml.php)  
[http://www.workalicious.com/dev/poc\_sepia\_events/scrollingEvents.html](http://www.workalicious.com/dev/poc_sepia_events/scrollingEvents.html)

Any advice would be much appreciated. I’m going to go smash stuff with a hammer now.  
Thanks,  
Dave
