Dear gurus and members,
I am new in actionscript and programming. I would like to know whether is it possible to use loadVar() to load a txt file stored in user's computer. I created an application and a txt file that are stored in user's computer. When user clicks on Flash button on my website, the actionscript will load the txt file. If the txt does not exist, the actionscript will prompt a message to quest user download the application. Otherwise, the actionscript will run a javascript function which will launch the application on user's computer.
I managed to write the script but there's another problem. When I click on the button, it will open a popup window telling me that I don't have the program installed even if I have it. It can't read the text file. The script doesn't work when I browse the file through a URL. I don't know why. Could someone please guide me through? The following is the script used:
on (release) {
myLV = new LoadVars();
myLV.onLoad = function(success) {
if (success) {
//if file loaded
trace("loaded");
getURL("java scriptpenRecorder();"); //open javascript function that calls an exe file on user's PC
} else {
//if file fails to load
trace("not loaded");
getURL("java script:dloadRecorder();");//URL to download Recorder program onto user's PC
}
};
myLV.load("file:///C:/Program%20Files/IEBAudioRecorder/test.txt");
}
This is the javascript function being called to launch the program from user's PC:
function loadRecorder() {
//loadexe()
location.href = "file:///C:/Program Files/IEBAudioRecorder/AudioRecorder.exe";
}
Looking forward to some replies soon.
Thanks in advance,
Janice
I am new in actionscript and programming. I would like to know whether is it possible to use loadVar() to load a txt file stored in user's computer. I created an application and a txt file that are stored in user's computer. When user clicks on Flash button on my website, the actionscript will load the txt file. If the txt does not exist, the actionscript will prompt a message to quest user download the application. Otherwise, the actionscript will run a javascript function which will launch the application on user's computer.
I managed to write the script but there's another problem. When I click on the button, it will open a popup window telling me that I don't have the program installed even if I have it. It can't read the text file. The script doesn't work when I browse the file through a URL. I don't know why. Could someone please guide me through? The following is the script used:
on (release) {
myLV = new LoadVars();
myLV.onLoad = function(success) {
if (success) {
//if file loaded
trace("loaded");
getURL("java scriptpenRecorder();"); //open javascript function that calls an exe file on user's PC
} else {
//if file fails to load
trace("not loaded");
getURL("java script:dloadRecorder();");//URL to download Recorder program onto user's PC
}
};
myLV.load("file:///C:/Program%20Files/IEBAudioRecorder/test.txt");
}
This is the javascript function being called to launch the program from user's PC:
function loadRecorder() {
//loadexe()
location.href = "file:///C:/Program Files/IEBAudioRecorder/AudioRecorder.exe";
}
Looking forward to some replies soon.
Thanks in advance,
Janice