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:
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:
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/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