View Full Version : Help with Photo Gallery??
spike101
11-22-2004, 01:34 AM
I was trying to work on something like the photo gallery tutorial at Actionscript (Here) (http://www.actionscript.org/tutorials/intermediate/Photo_Album_V2/index.shtml) However, I would want the pictures in no specific location on the page, but still enlarge to the middle of the screen, and then contract when they click on it again.
I think I can make this happen if I used a simple shape tween, but I have the feeling that this isn't the best way.
I would like to have approx. 50 thumbnails scattered about on the stage as if you just walked into a messy room and found them on the floor. Then I would like to have them enlarge to the actual pictures when clicked on.
Should I be trying to make this with an XML file that will load all the pics and be easily edited later or could I make a flash file that will load the thumbs from a folder in the same directory as the swf and then load the pictures from a 'pics' folder in the same directory?
My scripting is terrible so I found the tutorial a little hard to follow at some points. If someone knows of some other tutorials or knowledge on this subject that would be great....
thanks.
farafiro
11-22-2004, 01:42 PM
hi spike
u r just after the Math.random()
//the pix names are pix0.jpg tot pix49.jpg
//the stage is 600x400
//create an empty mc, give it a linkage name as holder_mc
// attach this script to it's first frame
tthis._width = this._height=50;
this.tgtW = 400; //the target width
this.tgtH = 250; //the target height
this.createEmptyMovieClip("h",1)
h.loadMovie(h._parent._name+".jpg")
//then delete it from the stage
//on the first frame of the root
var num:Number = 50
var stageW:Number = 600
var stageH:Number = 400
for(i=0;i<num;i++){
this.attachMovie("holder_mc", "h"+i,i,{_x:Math.round(Math.random()*StageW),_y:Math. round(Math.random()*StageH)})
}
spike101
11-23-2004, 05:05 PM
thanks...
I'll start to work on that...:)
spike101
11-23-2004, 11:04 PM
I couldn't get it to work.
I made 10 pictures with 400x250 dimensions. Then I changed the code to have 10 instead of 50 in the var num:Number="" section.
Then I made a MC with the name holder_mc and put the code on the first frame.
It wasn't on the stage so I shouldn't have to delete it should I?
Then I put the other code into the first fram of the main stage.
I saved the file into the same directory as the pictures and then published it.
I'm pretty new to Flash so a lot of this is pretty tough. But I thought if you wanted to see the pictures then you would have to reference them from something like an XML file. If there is nothing on the stage or in the clips, how can the pictures be seen clicked on, etc.?
farafiro
11-24-2004, 06:00 AM
post the fla
spike101
11-24-2004, 03:55 PM
I wasn't sure when you said create an empty movie clip whether you meant through code or by just doing it through the menu, but here's the fla....
farafiro
11-25-2004, 06:44 AM
just change the publish setting in your file in the flash tab to Flash player 7 and actionscript 2
also you can use this if u wantvar num:Number = 10;
for (i=0; i<num; i++) {
this.attachMovie("holder_mc", "h"+i, i, {_x:Math.random()*Stage.width, _y:Math.random()*Stage.height});
}
spike101
11-25-2004, 11:10 AM
okay.
spike101
11-25-2004, 11:39 PM
If I don't have the holder_mc on the stage I get nothing. If I drag it onto the stage and then test it, I get an error saying:
Error opening URL "file:///C|/.../.../.../.../.../.../instance1.jpg"
farafiro
11-28-2004, 06:19 AM
post the fla again with a sample pic if you can
spike101
11-28-2004, 08:32 PM
okay, I just zipped up the whole folder with the images, swf and fla inside.
I've been reading all sorts of articles on importing the images via XML, but they don't make it all that clear either.
If there is a good tutorial on something like importing the images with XML and then setting up so that there is a thumbnail for each image in the fla that would be great.
thanks for all the help so far.
farafiro
11-29-2004, 06:37 AM
The fla file is corrupted
see this one
http://www.actionscript.org/tutorials/intermediate/load_images_via_XML/index.shtml
spike101
11-30-2004, 10:19 PM
In case anyone was interested, there is a tutorial on this subject which I happened on the other day....
XML photogallery tutorial (http://www.tutorio.com/tutorial/simple-flash-xml-photogallery)
This has explanations for all the code and walks you through it. Very easy to follow with good results.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.