PDA

View Full Version : Reading data from a file



sharvan11
September 22nd, 2003, 05:32 PM
Hi,

I need to join three images adjacent to each other by reading the file locations from a text file or database.

After joining these images I have to make it to a single movieclip.

Is this possible using actionscripts? Even some hints about this will also be helpful for me.

sharvan

jingman
September 23rd, 2003, 02:10 AM
Well I don't think you can 'join' images, but you can certainly put them all in a single MC, and then manipulate that MC like it's a single picture.

eyezberg
September 23rd, 2003, 06:28 AM
pseudo code:
imgHolder = cretaEmptyMovieClip(params);
imgHolder.loadMovie("1stimg.jpg");
onload, check it's width,
load next one;
onLoad, check width & set _x position to width of previous;
same for the 3rd..

m_andrews808
September 23rd, 2003, 06:57 AM
You can load data from a text file like this, create a new text file and call it ImageData.txt and type this into it:

Images=Image1.jpg,Image2.jpg,Image3.jpg

put it in the same directory as your flash movie and add this code in the first frame of your movie:



function GetImages() {
ImageArray = new Array();
ImageArray = this.Images.split(",");
}

ImageData = new LoadVars();
ImageData.load("ImageData.txt");
ImageData.onLoad = GetImages;


this code reads the text file and creates an array of the images held in the file ready for you to load them as you like. This assumes that the image files are all in the same directory as your movie, if the images were in a subdirectory for example called 'Images' then your text file would look something like this:

Images=Images/Image1.jpg,Images/Image2.jpg,Images/Image3.jpg

hope this helps :P

sharvan11
September 23rd, 2003, 10:58 AM
I appreciate all your replies. i will be working on this over the weekend and see how it goes.

thank you very much