I am a beginner when it comes to Flash, ActionScript, and so forth. I started reading up on the subjects several months ago, when I decided my website needed a serious upgrade, and thought Flash would be the best way to achieve what I wanted. I've looked at a number of websites, and have done my best to figure things out on my own, but I've reached a point where I'm simply not sure how to proceed and would appreciate the help and guidance of someone who knows what they're doing.
Keeping my inexperience in mind, I'll do my best to accurately describe the problems I'm having.
1. I have a gallery based on the code from the tutorial on this site, but I would like to expand it in several ways - the first being, I would like to divide my gallery into multiple pages, but pull the thumbnails from a single XML file. Right now I have 8 thumbnails per page, with each page being a separate XML - this doesn't seem very efficient for when I want to update my gallery. What would be the best way to tell Flash to load the first 8 images from the XML, then the next 8 when a button is clicked, and so forth?
2. I would also like to allow the user to cycle through full sized images - that is, when the user is viewing a full image, they can click a button to go forward or backward to the next full-sized image without having to exit and go back to the gallery.
3. Lastly, I want the full sized images to be resized and repositioned based on the size of the browser window. Right now, the images appear to be scaled and positioned properly when I first click on them, but if I resize the window while the large image is up, it doesn't update it's size or position. I copied the initial code I was using to determine size/position so that I essentially am calling a function within a function. Needless to say, this seems a bad way of doing things, but I'm not sure else how to get it to work the way I want it.
Thanks in advance for your help!
To display 8 images per page, you can consider two variables...one for index and another for display 8 in page as follows:
var index:int = 0;
var imagesToDisplay:int = 8;
var imagesCount:int = 8;
for(var i:int = index;i < imagesCount;i++)
//code for loading and displaying images here...
next_btn.addEventListener(MouseEvent.CLICK,gotoNextPage); //next_btn is a button to go next page and display next 8 images...
prev_btn.addEventListener(MouseEvent.CLICK,gotoPrevPage); //prev_btn is a button to go last page and display previous 8 images....
if(index <= length of images - imagesToDisplay)
index += imagesToDisplay;
imagesCount += imagesToDisplay;
if(index >= imagesToDisplay)
index -= imagesToDisplay;
imagesCount -= imagesToDisplay;
For viewing the full size images of the gallery one by one, you need to take another next and previous buttons. At that time you have to get the images of the current page by checking xml as well. Use the code like above but the only difference is you need to consider index of those 8 images and thier length that is nothing but 8. For prev button
if(index > 0)
call the function which loads images...
For next button
if(index < 7)
call the function which loads images...
For placing the images constantly, you can take one movieclip to have all these images. Place that movieclip according to the stage.
mc.x = stage.stageWidth/ 2;
Note: I just want to provide you a basic idea. But this may not be the exact code. As per your requirements, you can change...and go on...
Thank you very much for the helpful reply! This seems like a solid foundation to work from. I'll spend some time playing around with this code and see if I can't get it to work. I'll let you know how that goes and if I have any more questions.
Again, thank you so much! Trying to figure this stuff out has caused me quite the headache for the past week...
Okay, I've pretty much got the buttons to move from each page and full image working properly, but I'm wondering if anyone has any advice as to how I could implement tweens with this function for smoother transitions? Right now, I'm just adding a new object to my image loader, and unloading the last one.
Europe, Middle East and Africa