Flash MX
November 25, 2004 1:00 PM   Subscribe

Flash MX question, is there a way to load a page from blogger (or an xml page) into a dynamic text block with a scroll bar?
posted by drezdn to Computers & Internet (3 answers total)
 
In short... yes.

If the page is valid XML, you can use the standard XML object to load and parse it. There's loads of tutorials out there on how to do that. Check out kirupa.com and actionscript.org.

There's also a lesser-known (and sneaky) trick you can use if external data isn't in a valid XML format. Load it using the LoadVars object, then in the onData() handler of the LoadVars you will have access to the entire document as one big string. You can then write your own code to parse it into the bits that you need. eg.
var bloggerPage = new LoadVars();
bloggerPage.onData = function(page) {
    // contents of file now accessible as 'page'
    trace(page);
}
bloggerPage.load("source.html");
To add a scroll bar, the simplest thing to do is drop in the scrollbar component that comes with Flash MX and associate it with the textfield. Also plenty of tutorials out there on that topic.

Final word of warning... you could face issues with Flash's inbuilt security restrictions which make it impossible for a Flash movie to load external data from a different domain from which the Flash movie is being served. This can be overcome by using a PHP script on your site to load the data from the remote server and pass it through to your movie.
posted by bruceyeah at 2:09 PM on November 25, 2004


As bruceyeah suggested, you're going to run into problems with Flash's "security sandbox" that doesn't allow you to load XML or a movieclip from another domain. I wrestled with this exact problem, specifically loading XML from blogger, and wrote a reallly simple PHP proxy to work around the security sandbox. Essentially, what you have to do is fake Flash into thinking that the XML file is actually coming from the same domain as your flash file.

This page on Macromedia's site should set you straight:

http://www.macromedia.com/support/flash/ts/documents/load_xdomain.htm
posted by jimray at 10:40 AM on November 26, 2004


Response by poster: thanks!
posted by drezdn at 5:30 PM on November 26, 2004


« Older Nature of the Universe   |   Hotels in Chicago Newer »
This thread is closed to new comments.