-
1. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 1:51 AM (in response to rlinsurf1)It is because of the faFile name is not loaded
Try this
var faFile;
this.createEmptyMovieClip("target_mc",this.getNextHighestDepth());
loadVariables("data.txt", target_mc);
function checkParamsLoaded() {
if (target_mc.faFile == undefined) {
trace("not yet.");
} else {
faFile = target_mc.faFile;
trace(faFile);
clearInterval(param_interval);
}
}
var param_interval:Number = setInterval(checkParamsLoaded, 100); -
2. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 1:58 AM (in response to webqaflash)I'm getting a syntax error when I try to run.
-
3. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 2:06 AM (in response to rlinsurf1)I think you are using Actionscript2.isn't it?
I just run the script and got the variable from text file
-
4. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 2:11 AM (in response to webqaflash)Yep. AS2.
This is Flash CS4 that I'm working in, BTW.
-
5. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 2:16 AM (in response to rlinsurf1)Please paste the error you are getting.
-
6. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 2:23 AM (in response to webqaflash)Scene=Scene 1, layer=Main Actions, frame =1, Line 10 Syntax error.
Line 10 is actually blank. It comes right after:
var faFile;
-
7. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 2:53 AM (in response to rlinsurf1)Try afterdeleting the var faFile;
It will be some error before the line10.
Please check your code before this.
Or Paste the above code in new document and run it.
Message was edited by: webqaflash
-
8. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 2:59 AM (in response to webqaflash)I tried both methods. When I just delete that line, the syntax error occurs on Line 10 -- a blank line before your code. When I paste it into a new document, and just run it, I get the syntax error with and without the first vars line.
-
9. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 3:11 AM (in response to rlinsurf1)When you run the code in a new document , where is the syntax error?
-
10. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 3:18 AM (in response to webqaflash)<sigh>
Copying and pasting from webpages.
I cleared out all the blank space from the script and it worked great. I'm now getting a bunch of
not yet.
not yet.
not yet.
not yet.
...
-
11. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 3:22 AM (in response to rlinsurf1)Whoops.
I forgot to change the .txt file to the actual name, Sweethearts_On_Parade_BRGK.txt. Now I'm getting:
undefined Error opening URL 'file:///jeffrey/Downloads/mp3%5Fplayer%5Ffiles/media/undefined' not yet. Sweethearts_On_Parade_BRGK.mp3
-
12. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 3:39 AM (in response to rlinsurf1)Please call the script
this.sound.loadSound ("media/" + faFile, true);After got the value of faFile.
Now you are trying load the sound before the name of the name of file got.
-
13. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 3:42 AM (in response to webqaflash)Do you mean like this:
loadVariables("Sweethearts_On_Parade_BRGK.txt", target_mc); this.sound.loadSound ("media/" + faFile, true);I'm getting the same error:
undefined Error opening URL 'file:///jeffrey/Downloads/mp3%5Fplayer%5Ffiles/media/undefined' not yet. Sweethearts_On_Parade_BRGK.mp3
I also tried it in several other places within your test, all the same result.
-
14. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 3:56 AM (in response to rlinsurf1)function checkParamsLoaded() {
if (target_mc.faFile == undefined) {
trace("not yet.");
} else {
faFile = target_mc.faFile;this.sound.loadSound("media/"+faFile, true);
trace(faFile);
clearInterval(param_interval);
}
} -
15. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:02 AM (in response to webqaflash)Sorry. Yes, I had tried it there as well. I tried it again just now, to be sure. Same error.
-
16. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 4:10 AM (in response to rlinsurf1)function checkParamsLoaded() {
if (target_mc.faFile == undefined) {
trace("not yet.");
} else {
faFile = target_mc.faFile;trace(faFile);//If you got the name of faFile(name of MP3) here, then you don't get the error message.
this.sound.loadSound("media/"+faFile, true);
clearInterval(param_interval);
}
} -
17. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:16 AM (in response to webqaflash)Here's the test code as is:
var faFile; this.createEmptyMovieClip("target_mc",this.getNextHighestDepth()); loadVariables("Sweethearts_On_Parade_BRGK.txt", target_mc); function checkParamsLoaded() { if (target_mc.faFile == undefined) { trace("not yet."); } else { faFile = target_mc.faFile; trace(faFile);//If you got the name of faFile(name of MP3) here, then you don't get the error message*. this.sound.loadSound("media/"+faFile, true); clearInterval(param_interval); } } var param_interval:Number = setInterval(checkParamsLoaded, 100);It's coming up with the same error.
Did you want me to upload the file?
-
18. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 4:17 AM (in response to rlinsurf1)Do you have the specified mp3 file in the media folder
-
19. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:19 AM (in response to webqaflash)Yes.
-
20. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:25 AM (in response to rlinsurf1)Let me ask you something. I've been testing another way to do this. What if I were to do something like this instead?
myVars = new LoadVars(); myVars.load("http://charlesnewmanpubl.com/Sweethearts_On_Parade_BRGK.txt"); myVars.faFile
How would I then use the faFile variable?
This probably wont work
this.sound.loadSound ("http://charlesnewmanpubl.com/media/" + faFile, true);Is there a better line than this if you're using loadVars instead?
-
21. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 4:27 AM (in response to rlinsurf1)First copy the mp3 file to the folder where the flash movie is placed.
then changr the code
this.sound.loadSound(faFile, true);
-
22. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:45 AM (in response to webqaflash)Sorry, no.
I'm now getting the error about it not being in the project file. I even added myVars. to it:
this.sound.loadSound(myVars.faFile, true);
But without the URL, faFile just says the name of the .mp3. So it points to the project file, and it still comes up as undefined.
-
23. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 4:47 AM (in response to rlinsurf1)Then you should try the fullpath of the mp3 file ie;"http://yourserver.com/............/"+faFile
-
24. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:55 AM (in response to webqaflash)Right. That's what I did:
this.sound.loadSound ("http://charlesnewmanpubl.com/" + myVars.faFile, true);No joy.
undefined Error opening URL 'http://charlesnewmanpubl.com/undefined'
-
25. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 4:57 AM (in response to rlinsurf1)Where did you get the myVars in myVars.faFile
-
26. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 4:59 AM (in response to webqaflash)Sorry, I thought that was how you were supposed to use it.
I have tried it both ways. Same thing.
-
27. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 5:06 AM (in response to rlinsurf1)First you have to test the path is working
Try to load the mp3, by hardcoding the path
For eg you have an mp3 file in a server like this
http://www.yourdomain.com/flash/media/mp3/nameofmp3.mp3
Then your code will like this
this.sound.loadSound("http://www.yourdomain.com/flash/media/mp3/"+faFile, true);
You should replace the bolded text with your correct path
-
28. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 5:08 AM (in response to webqaflash)Promise, that's what I've done.
this.sound.loadSound ("http://charlesnewmanpubl.com/media/" + faFile, true);
-
29. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 5:13 AM (in response to rlinsurf1)First try to load the mp3 with full url
this.sound.loadSound("http://charlesnewmanpubl.com/media/Sweethearts_On_Parade_BRGK.mp3", true);
If you got the script working then try
var faFile:String;
function checkParamsLoaded() {
if (target_mc.faFile == undefined) {
trace("not yet.");
} else {
faFile = target_mc.faFile;this.sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile, true);
clearInterval(param_interval);
}
} -
30. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 5:24 AM (in response to webqaflash)Excellent troubleshooting
Here's my output:
http://charlesnewmanpubl.com/media/undefined
Now wtf?
Sorry, should have said. When I tried the URL complete, no var, it plays.
I put in the test, and that was my output.
Message was edited by: rlinsurf1
-
31. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 5:25 AM (in response to webqaflash)This code is working fine for m, and I tested.Please note bolded one
this.createEmptyMovieClip("target_mc",this.getNextHighestDepth());
loadVariables("load.txt", target_mc);var faFile:String;
var my_sound:Sound = new Sound();function checkParamsLoaded() {
if (target_mc.faFile == undefined) {
trace("not yet.");
} else {
faFile = target_mc.faFile;
trace(faFile);
my_sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile,true);
clearInterval(param_interval);
}
}
var param_interval:Number = setInterval(checkParamsLoaded, 100);my_sound.onLoad = function(success:Boolean) {
if (success) {
my_sound.start();
trace("Sound loaded");
} else {
trace("Sound failed");
}
}; -
32. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 5:37 AM (in response to webqaflash)Ok. I created a new file. Put this in it:
this.createEmptyMovieClip("target_mc",this.getNextHighestDepth()); loadVariables("load.txt", target_mc); var faFile:String; var my_sound:Sound = new Sound(); function checkParamsLoaded() { if (target_mc.faFile == undefined) { trace("not yet."); } else { faFile = target_mc.faFile; trace(faFile); my_sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile,true); clearInterval(param_interval); } } var param_interval:Number = setInterval(checkParamsLoaded, 100); my_sound.onLoad = function(success:Boolean) { if (success) { my_sound.start(); trace("Sound loaded"); } else { trace("Sound failed"); } };
Here's the output:
not yet.
not yet.
not yet.
...
However, when I keep it in the original file, the file actually does play -- but no data is loaded from the .txt, i.e., nothing else is functioning.
not yet.
Sweethearts_On_Parade_BRGK.mp3
BTW, in case I haven't said it -- thank you for hanging in there on this. I could never be figuring this out on my own.
-
33. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 5:39 AM (in response to rlinsurf1)Please change the name of text file (load.txt to your textfile name).
-
34. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 5:44 AM (in response to webqaflash)Same results as before in both files.
not yet.
Sweethearts_On_Parade_BRGK.mp3
I also had run it again with the other filename. It's actually an 8 min. .mp3 file. After awhile of it playing, the output adds:
Sound loaded
-
35. Re: loadVariables "undefined" error
webqaflash Aug 6, 2009 5:49 AM (in response to rlinsurf1)this.createEmptyMovieClip("target_mc",this.getNextHighestDepth());
loadVariables("load.txt", target_mc);
var faFile:String;
var my_sound:Sound = new Sound();
function checkParamsLoaded() {
if (target_mc.faFile == undefined) {
trace("not yet.");
} else {
faFile = target_mc.faFile;
trace(faFile);
my_sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile,true);
clearInterval(param_interval);
}
}
var param_interval:Number = setInterval(checkParamsLoaded, 100);
my_sound.onLoad = function(success:Boolean) {
if (success) {
my_sound.start();
trace("Sound loaded");
} else {
trace("Sound failed");
}
};The above code is working for me.(with a text file load.txt having &faFile=Sweethearts_On_Parade_BRGK.mp3 )
I tested and heard the sound.
-
36. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 5:58 AM (in response to webqaflash)I found the problem with the new file. It wasn't saved, so had no location. When I saved it, you're right, it works.
So there is progress, sorry. It even works when the .txt is named Sweethearts_On_Parade_BRGK.txt.
But it isn't working when you use the real URL for the file.
Hence:
this.createEmptyMovieClip("target_mc",this.getNextHighestDepth()); loadVariables("http://charlesnewmanpubl.com/Sweethearts_On_Parade_BRGK.txt", target_mc); var faFile:String; var my_sound:Sound = new Sound(); function checkParamsLoaded() { if (target_mc.faFile == undefined) { trace("not yet."); } else { faFile = target_mc.faFile; trace(faFile); my_sound.loadSound("http://charlesnewmanpubl.com/media/"+faFile,true); clearInterval(param_interval); } } var param_interval:Number = setInterval(checkParamsLoaded, 100); my_sound.onLoad = function(success:Boolean) { if (success) { my_sound.start(); trace("Sound loaded"); } else { trace("Sound failed"); } };Just gets a bunch of not yet.'s
-
37. Re: loadVariables "undefined" error
rlinsurf1 Aug 6, 2009 6:14 AM (in response to rlinsurf1)Ok. I must have mercy on you.
Thank you for all the help, and for getting me farther down the road. I guess I'll take another crack at it tomorrow.
Thanks again.

