malino11
11-11-2004, 05:43 PM
Hello,
I am trying to load external text based on the name of the SWF movie. I need to create several SWF files, which will each function as an independent quiz question. Instructors will edit the TXT files without having to work in Flash. If the SWF is named "1" I'd like it to load text dynamically from a text file named "1". This will save me from hard coding what text file will be loaded each time. There could be hundreds of questions total in the end. All of the files will need to exist in one directory.
I managed to trace the name of the SWF file using:
function getFileName(fileUrl) {
var fileName = fileUrl.substr(fileUrl.lastIndexOf("/")+1, fileUrl.length);
return unescape(fileName);
}
trace(this.getFileName(this._url));
Any ideas how I drop the ".SWF" extension and store this file name value as a variable? How can I tell flash to load [variable].txt instead of a known txt file?
Any help would be greatly appreciated. Thank you for your time.
I am trying to load external text based on the name of the SWF movie. I need to create several SWF files, which will each function as an independent quiz question. Instructors will edit the TXT files without having to work in Flash. If the SWF is named "1" I'd like it to load text dynamically from a text file named "1". This will save me from hard coding what text file will be loaded each time. There could be hundreds of questions total in the end. All of the files will need to exist in one directory.
I managed to trace the name of the SWF file using:
function getFileName(fileUrl) {
var fileName = fileUrl.substr(fileUrl.lastIndexOf("/")+1, fileUrl.length);
return unescape(fileName);
}
trace(this.getFileName(this._url));
Any ideas how I drop the ".SWF" extension and store this file name value as a variable? How can I tell flash to load [variable].txt instead of a known txt file?
Any help would be greatly appreciated. Thank you for your time.