Answered
Help with loading multiple images via LoadVars
Hello everybody.
I need a hand loading multiple images using the LoadVars method with a text file. I can get it to load 1 image but not anymore than that. I am aware of other methods like using components but I am looking for a method where I can access and change all data from 1 text file (there will be text variable text within the file aswell to, but I am more concerned with the images at the moment).
Anyway on to the issue. I have created a much simple .fla file that outlines my problem.
The movie contains 3 layers:
- top layer contains AS
- middle layer contains an empty movie clip with the instance name of mcImage1
- bottom layer contains an empy movie clip with the instance name of mcImage2
The AS layer contains the following code:
imagedata = new LoadVars()
imagedata.load("data.txt")
imagedata.onLoad = function(ok){
if(ok){
mcImage1.loadMovie(this.Image1)
mcImage2.loadMovie(this.Image2)
} else trace("Problem Loading")
}
In the same folder of my .swf file I have a text file called data.txt which contains the following
&Image1=image1.gif
&Image2=image2.gif
Also in the same folder of my .swf file I have two images image1.gif and image2.gif.
When I run the flash the image2.gif is imported correctly. image1.gif does not appear.
You can download my source files and all images here
http://www.myrealpage.com/projects/var_test/var_test.zip
Any help that can be shed on this problem is much appreciated.
Thanks
Matt
I need a hand loading multiple images using the LoadVars method with a text file. I can get it to load 1 image but not anymore than that. I am aware of other methods like using components but I am looking for a method where I can access and change all data from 1 text file (there will be text variable text within the file aswell to, but I am more concerned with the images at the moment).
Anyway on to the issue. I have created a much simple .fla file that outlines my problem.
The movie contains 3 layers:
- top layer contains AS
- middle layer contains an empty movie clip with the instance name of mcImage1
- bottom layer contains an empy movie clip with the instance name of mcImage2
The AS layer contains the following code:
imagedata = new LoadVars()
imagedata.load("data.txt")
imagedata.onLoad = function(ok){
if(ok){
mcImage1.loadMovie(this.Image1)
mcImage2.loadMovie(this.Image2)
} else trace("Problem Loading")
}
In the same folder of my .swf file I have a text file called data.txt which contains the following
&Image1=image1.gif
&Image2=image2.gif
Also in the same folder of my .swf file I have two images image1.gif and image2.gif.
When I run the flash the image2.gif is imported correctly. image1.gif does not appear.
You can download my source files and all images here
http://www.myrealpage.com/projects/var_test/var_test.zip
Any help that can be shed on this problem is much appreciated.
Thanks
Matt