Groups | Blog | Home
all groups > flash data integration > september 2006 >

flash data integration : Static vs. Dynamic XML


MaveK
9/28/2006 8:59:04 PM
Hello all,

I have been stumped on this one for over a year now. I have created a Flash
Map that functions properly with a static XML file but when I try to load a
dynamic XML generated my ColdFusion I get no results. The example can be found
at: http://beginning.achel.org/map/works.html The one that does not work is at
http://beginning.achel.org/map/

This map should load the different states that are in the XML file but instead
it does not load any of them. The two different XML files can be found at:
http://beginning.achel.org/map/states.xml and
http://beginning.achel.org/map/states.cfm An interesting note: Firefox does not
recognize the cfm file as a XML file but IE does. This may be based on the file
extension.

The Action Script is exactly the same except that it references adifferent
file. The Flash works when published for Flash Player 6 but when I try to
publish for Player 8 even the static XML does not work.

I am probably over symplifying this but it seems logical to me. Please let me
know if you need any more information for this problem. I will post more as I
play around with it.

Thanks!

function Org(state, acronym, name, address1, address2, city, zip, email, url){
this.state = state;
this.acronym = acronym;
this.name = name;
this.address1 = address1;
this.address2 = address2;
this.city = city;
this.zip = zip;
this.email = email;
this.url = url;
}

function States(){
var e = OrgsXML.firstChild;
if (e.nodeName == "STATES") {
e = e.firstChild;
aStates = new Array();
while (e != null) {
this.map[e.attributes.state].enabled = true;
// this.map[e.attributes.state].gotoAndStop("Over");
var h = new Org(e.attributes.state,
e.attributes.acronym,
e.attributes.name,
e.attributes.address1,
e.attributes.address2,
e.attributes.city,
e.attributes.zip,
e.attributes.email,
e.attributes.url);
aStates.push(h);
e = e.nextSibling;
}
}
}

var OrgsXML = new XML();
OrgsXML.ignoreWhite = true;
OrgsXML.onLoad = function(success:Boolean) {
if (success) {
States();
} else {
trace("Load Status: error")
}
};
OrgsXML.load("states.cfm");

function loadStates() {
for (i in this.map) {
if (this.map[i] instanceof Button) {
this.map[i]._visible = false;;
}
}
for (var i:Number = 0; i < aStates.length; i++) {
this.map[aStates[i].state]._visible = true;
}
}
dan mode ->Adobe Community Expert
9/29/2006 4:51:00 PM
[quoted text, click to view]

If this is the case, tell the timeline not to proceed until it is loaded.

[quoted text, click to view]

IE loves to cache anything it can. IE doesn't know that your content is
dynamic, try putting a random variable at the end of your load.
randomVar = Math.random();
OrgsXML.load("states.cfm?random="+randomVar)

[quoted text, click to view]

Yeah, you can't see the cfm dynamic data until it is processed by cfm, which
is on the server. If you had cfm on your local machine as well as the
source data, then you could do it. Until then, you'll have to do your
testing on the server.


--

Dan Mode
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com
*Must Read* http://www.smithmediafusion.com/blog


MaveK
9/29/2006 8:39:19 PM
OK, I have narrowed down the problem... but I still need HELP!!!

First, the version problems were related to case sensitivity. (fixed)

Second, the dynamic XML data still does not load (in time). It appears that
the CFM file is not loading quickly enough and the flash file generates before
it gets any/all the data. I believe this is the case because when I load the
file the first time in IE none of the data appears but if I refresh then the
correct data displays. I thought that I had written the AS to wait for the
onLoad to finish loading the file before proceeding. (see attached code)

This also begs the next question, why is IE caching the dynamic data? The
reason that I am using a CFM page is that I want it to be up to date. In
FireFox I never get the data to display because it appears to be getting the
data each time.

One other thing, how do you debug in the browser? I am using dynamic data off
the server and therefore can't debug it until I upload the file to the server.
I tried downloading the Flash Player 9 debugger but that appears to only work
for Flex. Is this correct?

Thanks again to all!


var OrgsXML = new XML();
OrgsXML.ignoreWhite = true;
OrgsXML.onLoad = function(success:Boolean) {
if (success) {
// trace("Load Status: Sucess");
_global.x = States();
} else {
trace("Load Status: error");
}
};

OrgsXML.load("states.cfm");
AddThis Social Bookmark Button