Copy link to clipboard
Copied
I guess this is very simple. Stage has a textField (filenumEnter) and a button (setinfo_btn). The goal is loading a specific local file (with naming protocols being "file1.xml" etc.) without having to use FileReference. I have had success in hard coding a limit of documents, but thinking about situations where somebody creates 30 files and wants to access, for example, file 22. You can't just set it up like this:
var fileNum = filenumEnter.text;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);
var xmlData:XML = new XML();
function loadXML (e:Event): void {
xmlData = new XML(e.target.data);
trace(xmlData);
} //My focus is on the below function
function fileLoad(event:MouseEvent): void {
if (event.currentTarget == setinfo_btn) {
fileNum = filenumEnter.text;
xmlLoader.load(new URLRequest("file[fileNum].xml"));
}
So I am hitting a minor roadblock on how to do this with the user entering a number in the textField. I guess I could use a comboBox instead, but then wouldn't I have to update it everytime to make sure it is up to date?
This ought to work:
xmlLoader.load(new URLRequest("file"+fileNum+".xml"));
Copy link to clipboard
Copied
This ought to work:
xmlLoader.load(new URLRequest("file"+fileNum+".xml"));
Copy link to clipboard
Copied
Of course! Something so simple, I just completely forgot about it. Goodness!
Thanks!