Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading JPEG file name in an array and using this as para for LoadMovi 1

Status
Not open for further replies.

arash107

Technical User
Aug 11, 2003
2
US
I am trying to make a photo album, but I just do not want to add images expilicitly... I want them to come out of an array.... and moreover I need to use the LoadMovieNum method to access the Images.
It wuould be great If i did not have to load the pictures in the Arrray too.... it should be dynamic there too.. I mean that It should take all the Jpeg files form a particular Dir. and load in it in the array.

Sleepless nights because of this,
Thanx in advance
Arash.
 
You'll have to prefill the array with the names of the pictures you want to load - two ways to do this are:

1)Know the names in advance and hardcode them - if you use a generic name like 'pic' you can stick a number after it and rename your images to agree

2)Use a server side script to browse the images directory and pass the filenames to Flash as name/variable pairs.

The actual loading code is pretty straightforward:

Code:
loadImageIntoLevel = function (pic) {
	loadMovieNum('picDirectory/'+pic+'.jpg', 1);
};
//
loadImageIntoClip = function (clip, pic) {
	clip.loadMovie('picDirectory/'+pic+'.jpg');
};
//
picsArray = ['pic1', 'pic2', 'pic3'];
loadImageIntoLevel(picsArray[0]);
loadImageIntoClip(_root.loadPoint, picsArray[2]);
//
stop();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top