-
Special Member
Problem with xml on server
HI, I have contents in a site coming from xml. This site works fine on local machine but when I upload it on server and check that same site from server it show "undefined" on the text fields. When i refresh browser window then it show contents. The xml file size is 7kb only.
Can you tell me why this problem is coming and how to solve this.
Thanks
[Illustration][Commercial Designing]
[Textile Designing][Large Format Printing] [Web Designing]
-
FK'n_dog
what actionscript are you using to populate the textfields ?
you need to be using the XML.onLoad function (AS2) to ensure loading has completed.
-
Special Member
Sorry for late reply here is the code which i am using:
PHP Code:
function loadXML(loaded) {
if (loaded) {
//----page one ------
_root.page1head1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.page1para1 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.page1head2 = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
//----page two ------
_root.page2head1 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
_root.page2para1 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
_root.page2para2 = this.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;
//----page three ------
_root.page3head1 = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;
_root.page3para1 = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("data.xml");
Please let me know if this code is ok
Thanks
[Illustration][Commercial Designing]
[Textile Designing][Large Format Printing] [Web Designing]
-
FK'n_dog
I cannot see any problem with your code,
in a test file, can you add a stop action to the frame where the xml loads
and advance the timeline within the onLoad function. this test should check
that all xml loading and parsing is completed.
-
Special Member
Thanks, your idea was right. I have add stop action where xml loads.Then I have used set Interval to stop playhead for a while then move ahead. It works!
Now i have one different question. I want to load each time refresh xml not from cache because contents are changing from admin site.
How can i do this?
Thanks
[Illustration][Commercial Designing]
[Textile Designing][Large Format Printing] [Web Designing]
-
FK'n_dog
add a timestamp to force fresh data from the server -
xmlData.load("data.xml?vers="+new Date().getTime());
-
Special Member
I used this:
xml.load(”file_name.xml?” + random(9999));
it also works!
Thanks for your help
[Illustration][Commercial Designing]
[Textile Designing][Large Format Printing] [Web Designing]
-
XML parsing takes too much long time
Hi...
I have a XML having 174 nodes overall.
Some node has value while some may/maynot have value.
When I parse it for a game play, it takes too much long time to get parse causing preloader to run for approx 1-2min.
Rest afterward it goes all OK.
Any help to reduce the parsing time so that it can be parse fastly for a quick game play.
I need it to be done earliest.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|