Skip to main content
Participating Frequently
April 19, 2006
Question

"XMLConnector.URL = variable" problem

  • April 19, 2006
  • 2 replies
  • 337 views
Okay here is the deal.

Situation:

Using Flash 8 with XMLConnector, DataSet and DataGrid components.

XMLConnector with instancename: myXMLConnector

I want to let the URL for the XML file be defined in an external text file system.txt
The textfile looks like this: &xml_location=C:/www/stat.xml

Then I added this code to the 1st frame timeline of the XMLConnector
loadVariables("system.txt", "_root");
myXMLConnector.URL = xml_location;


But it doesn't work, I get an "undefined" error when I try to execute the movie...
Can anyone tell my why this doesn't work? Why doesn't the XMLConnector detect the variable propperly?

Setting the XML path directly (without the external variable textfile) works fine:
myXMLConnector.URL = "C:/www/stat.xml";
But that isn't good enough, I specifically need the XMLConnector to get the URL from an external file.

I have used a very similar technique to define button onRelease URLs externally (also in the system.txt file) and that worked out great... but this doesn't :wacko:, I've searched with google for hours and can't find a real solution, or atleast a hint of what I'm doing wrong.

Thx in advance.

p.s. I have already tested the system.txt file by making a dynamic textfield in the scene and letting it get the body from a variable in the system.txt. I worked like a charm... but the XMLConnecter just won't work
This topic has been closed for replies.

2 replies

PayBasAuthor
Participating Frequently
April 19, 2006
Hey man thx a million for your swift replies. You helped me out a lot with this

I think this kind of thing is a typical problem for people like me who have only used Flash for little more then a week and immediately want complex stuff .

I have been building my app completely from pre-fabricated Flash8Pro components that eliminate most of the Actionscripting... but without that knowledge you get stuck on things like this .

I should spend more time learning Java/Actionscript.

Thx again.
Inspiring
April 19, 2006
You're welcome.
Inspiring
April 19, 2006
If you want to load variables in a specific level, use loadVariablesNum():

PayBasAuthor
Participating Frequently
April 19, 2006
Thx for your reply.

I did like you said, I implemented it on the main timeline and after building the app there is a textmessage with a log (or so it seems). Here is a part of it:

not yet.
finished loading. killing interval.
-------------
xml_location: C:/www/stat.xml

:
param_interval: 1
checkParamsLoaded: [type Function]
__junk: [object Object]
$version: WIN 8,0,22,0
reserved: _level0.reserved
focusManager: _level0.focusManager
__databind_dispatch: _level0.__databind_dispatch
button_load_stats: _level0.button_load_stats
myXMLconnector: _level0.myXMLConnector
-------------


So I guess that means that it has loaded the system.txt correctly (I tried changing the path to force an error and all I got was "not yet", "not yet", "not yet"), so that seems to be working...

However, when I try to activate the XML connector I still get "undefined" with the setting myXMLConnector.URL = xml_location;

The XMLConnector is still in level 0, which is also where the variabels are loaded too. So maybe I missed something here... but I still get the same error.
Inspiring
April 19, 2006
You have to put your statement in the checkParamsLoaded()