keitai
June 25, 2003, 2:34pm
1
I need some suggestions on this.
This my starting-point
1 I have to use a swf like: whatever.swf?file=abc1234
2 file=abc1234 represents the name of the xml file i need to load like
_root.xmlDocument.load(abc1234);
But i want to use
_root.xmlDocument.load(file);
Because the filename is auto generated.
Any tips
system
June 25, 2003, 2:45pm
2
Ok i made a quick fla and then in the html replaced filename.swf with filename.swf?file=122. i made a dynamic text field with variable name file and saved/published.
When i opened the html document it read 122 in the text box, so this method should be ok
system
June 25, 2003, 3:04pm
3
Hi dravos,
thnks for replying but that’s not what i am after. I know how to display/use a variable like that.
In your case the variable file has a value of 122 and i would like to load a xml file called 122 (i don’t use the xml exteension) with
_root.xmlDocument = new XML();
_root.xmlDocument.ignoreWhite = true;
_root.xmlDocument.load("122");
So i like to make 122 a string or text instaed of a value.
Sorry for my bad english.
Grtz
system
June 25, 2003, 3:14pm
4
ok well the variable isnt a value or string, its not got a type really.
if you pass filename.swf?file=122.swf instead then you can use that in
[AS]_root.xmlDocument.load(file);[/AS]
or you could read filename.swf?file=122
and in the AS
[AS]file=file+".xml"
_root.xmlDocument.load(file);[/AS]
if you add the extension it makes it a string in a way
system
June 25, 2003, 3:25pm
5
yep you right.
But for security reasons, i don’t know about, we/they don’t want to use extensions. I tried to load a .xml file without the xml extension and it works. ( I have the xml-file without the extension in the same folder)
So any “more” tips for my case?
I already tried:
_root.xmlDocument.load("\""+file+"\"");
and
_root.xmlDocument.load("file");
But in the latter case flash thinks it’s a xml file called file.
Also (abc1234).toString() gives me a undefined trace message. Is a letter and number combination to hard for flash?
Doesn’t do it for me
system
June 25, 2003, 3:34pm
6
you could try
[AS]_root.xmlDocument.load(eval(file));[/AS]
system
June 25, 2003, 3:37pm
7
yeah .toString is only used for objects not variables i think.
[AS]_root.xmlDocument.load(String(file));[/AS]
system
June 25, 2003, 3:48pm
8
gonna try your suggestions
system
June 26, 2003, 9:34am
9
finally got it working.
With
_root.xmlDocument.load(String(_root.file));
thnks dravos.
One question, though. I thought i did this by
XMLtoLoad = String(file);
_root.xmlDocument.load(XMLtoLoad);
So what’s the difference and why won’t the second AS work??
Grtz,
system
June 26, 2003, 10:13am
10
if the first one was _root.file then the second one probably needs to be the same…
Anyway, glad you got it working
Dravos
system
June 27, 2003, 9:57am
11
Last question ( i hope),
How can i load a file that is a directory higher.
_root.xmlDocument.load("../" +String(_root.file));
doesn’t worked.
Never mind got it working. i am so stupid - i forgot to load the xml on the my server a directory higher.
system
June 27, 2003, 10:38am
12
Doh… Glad you got it working anyhow… Happy Scripting…
Dravos