PDA

View Full Version : loadVariables & loadMovie troubles


xyboox
05-17-2005, 01:40 PM
Hi,

it seems to be so simple, and still...not working:

on the first frame of the movie, I have an actionscript:
loadVariables("myData.txt", this);

in myData.txt I've wrote:
&fisier=1.jpg&

Then, on the second frame ( and the last one ), I have an empty movieclip, with an instance called "target_mc" and an actionscript:
loadMovie(fisier, this.target_mc);
stop();

In the same folder with the .swf I have a .jpg called 1.jpg

Now, my question is: WHY ISN'T "1.JPG" LOADING?? I allways get the error message: "Error opening URL "file:///C|/Documents%20and%20Settings/...../undefined" !!

Do I have to declare somehow the variable "fisier" as global ( like in php )?? Or...what else is missing???

As a note: if I put a dynamic text on the second frame, and set the value to be the variable "fisier", the text box displays correctly the value of "fisier" !! So loadVariable is working ok, but the value of the retrieved variable is lost when I try to use it in loadMovie statement.

Thankx for any help you may give me!

oldnewbie
05-17-2005, 01:45 PM
Are you testing this locally or online?

xyboox
05-17-2005, 01:50 PM
I've tried them both: local and online. The same result, except that online I don't get the error message, but the .jpg is still not loaded.

Xeef
05-17-2005, 01:54 PM
loadVariables("myData.txt", this);//the load starts
//play head is going on
loadMovie(fisier, this.target_mc);//the load is NOT finished jet
//coud even take hours by a 1000BM file
stop() //some when the load is finished and shows the corect value in the dinamyc text field by such a smal file you not realyze that you Dinamyc text shows for a while undefined
//look up "LoadVars.onLoad" in the help

xyboox
05-17-2005, 02:02 PM
your notes seems to be more than fair...but:

if I change in loadMovie(fisier, this.target_mc) the url with "1.jpg", everything is just fine: the picture is displayed.

Anyway, I'll try using LoadVars.onLoad. Hope to find useful info in help :)

xyboox
05-17-2005, 02:34 PM
so, I've tried with LoadVars.onLoad and...still not working. Here is the actionscript on the second frame, and on the first I've deleted everything:
this.LoadVars.sendAndLoad("myData.txt", this);
this.LoadVars.onLoad = function(success) {
loadMovie(fisier, this.target_mc);
};
trace(fisier);
stop();

oldnewbie
05-17-2005, 04:13 PM
loadVarsText = new LoadVars();
loadVarsText.load("myData.txt");
loadVarsText.onLoad = function(success) {
if (success) {
trace ("done loading");
picToLoad = this.fisier;
trace(picToLoad);
target_mc.loadMovie(picToLoad);
} else {
trace ("not loaded");
}
};

xyboox
05-17-2005, 04:34 PM
O...thankx!!! Thankx a lot! It works! Thanks @oldnewbie!!!

oldnewbie
05-17-2005, 04:54 PM
No problem! May the force be with you! ;)

Xeef
05-17-2005, 06:49 PM
and be aware of the dark side !