XML/flashMX ??
- Started
- Last post
- 24 Responses
- heavyt
real quick question:
i have a flash banner which uses an XML file for the prices.
it works fine on my computer, but it doesnt work online.
both files are in the same directory.
is something preventing the swf from getting to that XML file ???
they are both hosted on our server.thanks,
TR1
- JazX0
hmmmm? unfit would know
- heavyt0
no doubt. i think that he probably is the one that got me this far on the project.
hopefully he is feeling generous today.TR1
- JazX0
lol, not sure as I don't think your server would refuse the XML
- enobrev0
are you accessing the xml file locally (as in using a relative directory or just a file name) or are you accessing it remotely (via a url)?
- heavyt0
it is linked as a relative file (prices.xml)
they are both in the same directory, so i though it wouldnt be a problem.TR1
- unfittoprint0
you could have to change your xml file's encoding to UTF-8.
advice:
a lot of the problems people have while developing offline is they don't do their code sequentially [first this, then that, etc...].Since offline Flash tends to compile almost instantenously, certain errors don't occur. This happens a lot with LoadVars, XML, Sound objects.
Remember: functions you use to parse the XML must 'live' within an onLoad [if(success)] event .
- enobrev0
'live in' as in to be performed after a load not during, yes?
anyways, i usually find it to be a good idea to use the full url to a data file. That way you know it's ALWAYS accessing the same file regardless (unless of course you HAVE to have local versions for specific reasons)
- JazX0
wow unfit is a rockstar
- unfittoprint0
eno, there are security issues that prevent [in most cases] accesing external files.
- heavyt0
unfit,
i have a function onMyLoad which runs until the data loads. (or at least it is supposed to)
the XML file is small. only 4 nodes in the array, so i am hoping that load time is very small.
i tried changing the banner to an exact path. it may take a while for it all to refresh online befor ei can test.
any other suggestions would be greatly appreciated.
TR1
- unfittoprint0
use a relative path.
test your xml file in a browser to see if it works.
you could have some old stuff in cache that wil prevent the updated file to show on the server.
you could append some random number to prevent that like
myXML.load("myxml.xml"+"?"+Math...
- enobrev0
i've never had any issue with it. I know you can't access form one domain to the other, but coming from a local file to a remote server has never been a problem, at least not on my twisted planet.
- heavyt0
this is my actionscript.
can you see any problems with it?//creates a new XML Object
pricedata = new XML();
// loads the local file prices.xml into the object and parses it
pricedata.load("pricesfordc.xml...
// creates new array to place the "tree" of the xml file into
pricelist = new Array;// function to test if file is loaded before it navigates the tree;
function myOnLoad () {
pricelist = pricedata.firstChild.childNodes;//returns length of array to be sure I read it correctly.
testVarLength = pricelist.length;
//array
Var = pricelist [0].firstChild.nodeValue;
Var2 = pricelist [1].firstChild.nodeValue;
Var3 = pricelist [2].firstChild.nodeValue;
Var4 = pricelist [3].firstChild.nodeValue;
Var5 = pricelist [4].firstChild.nodeValue;
Var6 = pricelist [5].firstChild.nodeValue;}
//keeps "calling" to see if the file is done loading, and runs function when done
pricedata.onLoad = myOnLoad;
- unfittoprint0
I think I know what the problem is. As stated earlier when devloping offline order sometimes will not influence the outcome. however when online, things tend to be slower, so it's good to make stuff sequentially. that's why you should put your :
pricedata.load("pricesfordc.xml...
in the end.
- heavyt0
ok, cool.
before i pull a "major F-Up" :i should just move that line to the very end?
TR1
- unfittoprint0
in the deep, deep end.
- heavyt0
could taht ever cause the Var to display a null value??
just thinking that at first, it is tryign to load the Var into an array with data that hasnt been called yet.please let me know if this could be a prob.
gracias.
TR1
- heavyt0
it still isnt workign right. it will not load those files. i see the rest of the banner, but it is without prices.
i cannot imagine what it is doing.is it possible that i need to only load the entire banner after all of the XML loads or soemthing?
TR1
- punkture0
how much do the grafiks weight and is their preloading in there, are u using linkage? are there grafiks that load on 1st frame?
- heavyt0
there is no preloader, images start on the first frame.
the file is small, only 20k.
not sure what you mean by "linkage", but they all have getURLs on them. no other files or MCs are linked within the file.TR1