valentin_v
asked on
Import images on the fly based on value from txt file
Hi all.
I'm looking for a solution.
I'm going to have 10 different pictures, that I'll need to import into flash based on value from txt file. So lets say I have in txt file content picture1, i need to import picture1,jpg on the fly, or if there is value in text file picture5, i need to import picture5.jpg
If I have picture1,picture5,picture6 ,picture8 in txt file, i need to import all pictures picture1,jpg, picture5.jpg,picture6.jpg, picture8jp g
I want to have horizontal scroll of the images, so I can see past images that were included before. And if I click on one of the images, some info sould be shown, again from txt files or another type of files HTML lets say
Thanks in Advance
Valentin
I'm looking for a solution.
I'm going to have 10 different pictures, that I'll need to import into flash based on value from txt file. So lets say I have in txt file content picture1, i need to import picture1,jpg on the fly, or if there is value in text file picture5, i need to import picture5.jpg
If I have picture1,picture5,picture6
I want to have horizontal scroll of the images, so I can see past images that were included before. And if I click on one of the images, some info sould be shown, again from txt files or another type of files HTML lets say
Thanks in Advance
Valentin
actually something more like this should work...
myData = new LoadVars();
myData.load("var.txt", myData, "POST");
myData.onLoad = function(){
for(i=0; i<5; i++){
var img = this['myData.pic'+i];
var con = this['_root.container'+i];
loadMovie(img, con);
}
};
stop();
rp
myData = new LoadVars();
myData.load("var.txt", myData, "POST");
myData.onLoad = function(){
for(i=0; i<5; i++){
var img = this['myData.pic'+i];
var con = this['_root.container'+i];
loadMovie(img, con);
}
};
stop();
rp
ASKER
How to create container movieclips at runtime.
Have a look at this tutorial which demonstrates quite nicely how to create such containers at run time.
http://www.actionscript-toolbox.com/samplemx_loadjpg.php
http://www.actionscript-toolbox.com/samplemx_loadjpg.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
only a "B"?
:(
rp
:(
rp
open Notepad and copy and past the below text:
pic1=picture1.jpg&pic2=pic
save the file as "var.txt"
then in your Flash movie, use this code in the first frame(Assumes you have Flash MX):
myData = new LoadVars();
myData.load("var.txt?nocac
myData.onLoad = function(){
for(i=0; i<4; i++){
var img = this['myData.pic'+i];
var con = this['myData.container'+i]
loadMovie(img, con);
}
};
I have not tested this code, but it should be okay... it will load the variables, and then load the jpegs into container movieclips(that you need to create either at runtime or manually) with the instance names of container1, container2, etc etc...
have a crack at this code, and let me know what you get...
rp