|
Well. When you first enter the flash file, you start at the '_root' level. What you're wanting to do is have the thumbnails of your photographs to become buttons that reference the full sized images; the basic idea of a gallery or portfolio page. There's a zillion different ways to do this of course, but I'll present a few to you.
This is AS 2.0:
1. You want to setup a frame (possibly the very top frame) to handle nothing but Actionscript; this keyframe will be empty of all elements (although it doesn't have to be) and will act as the main control center. In many of the flash projects that I build, I have thousands of lines of actionscript, so I typically build an external actionscript file that I call internally (if the external is 'action.as', call with - 'include# action.as') For your purposes, there's no need for external file usage, so no worries. Anyhow, have the first frame of the movie at the very top be the AS layer for just actionscript containing.
2. Have all the elements dealing with the 'gallery' under this layer WITH reference (call) names (these 'call' names are defined in the properties panel - just name the movieclip after you create it; don't rely on 'just' naming the new movieclip when you create it - it is necessary to be sure you're referencing the correct element, so label the movieclip as well.
The reason it is important to have all of the elements placed within the same column as the starting AS keyframe is that flash wants to define all functions and properties upon load and thus, will notice the referenced movieclips from the AS layer right off if they are lined up. This isn't necessary if you call functions in the AS layer for specific movieclips functionName('myLayer'); after the function has been defined and a listener has been set in place - again, for your purposes, we aren't going to do that.
3. Alright.. now enough starter knowledge - your layer that will hold the big image is called 'myLayer', right? OK. After all of the thumbnails have been placed within their individual movieclips (right click thumbnail > convert to movieclip), label each one.
Label them thumb1, thumb2, thumb3 for now...
In your AS layer at the top, type in (in the actions panel):
_root.thumb1.onRelease = function() {
//not yet defined
};
_root.thumb2.onRelease = function() {
//not yet defined
};
_root.thumb3.onRelease = function() {
//not yet defined
};
-- this defines a function for the predefined 'onRelease' function built into flash; currently the function are empty and are marked by comments ('//not yet defined')
4. You need to know where your large pics are going to be located - are they going to be externally brought in or are they already going to be inside of the initial flash file you're working on. In order to merely understand the basics, just do this:
Place the photographs on separate keyframes - as in, keyframe 1 (column 1) will contain the large image that thumb1 (the button) will reference. Keyframe 2 (column2; to the right of keyframe 1) will contain thumb2's referenced full image. Now, create a new frame row above these images. Separate each keyframe above each image so Keyframe 1 has a blank frame above the full image 1 - Keyframe 2 has a blank frame above the full image 2. Enter stop(); into each of the individual keyframes in the actions panel. This will stop the play function when the thumbnail calls up the movie.
5. Now your home-free;
Tell the thumb buttons to go to their referenced images in 'myLayer'.
Here is the finalized code for the buttons to be placed in your main AS layer:
_root.thumb1.onRelease = function() {
_root.myLayer.gotoAndPlay(1);
};
_root.thumb2.onRelease = function() {
_root.myLayer.gotoAndPlay(2);
};
_root.thumb3.onRelease = function() {
_root.myLayer.gotoAndPlay(3);
};
This leaves out a great amount of detail such as rollover and rollout functions and transitions from pic to pic - but it should at least give you a general idea of how actionscript 2.0 defines and calls items.
|