Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    How to go to Frame1 in myLayer??

    Hello

    When I load my Flash movie and click on 'Portfolio', I can see a list of links and small photographs. When I click on one of the links/small photographs I am taken to a different location in my Flash movie.

    I have created a new layer in my Flash file (FLA) called myLayer. How can I change my file (FLA), so that when I click on a small photograph/link in my movie, I go to a frame in my new layer?

    I do NOT want to link to an HTML page outside my movie; I want to click on a link/small photo and be taken to the new location I have created.

    How do I do this, please? At the moment there is nothing in the AS panel or Properties panel when I highlight the small photo(s) or link so I do not know how the link works at the moment.

    Thanks.

    Steve

  • #2
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    That's very informative, JP, many thanks.

    I've saved your message and will go through it carefully.

    Yes, I already have a layer which contains all the thumbnails (frame 1 has one thumbnail, frame 2 (same layer) has another thumbnail and the thumbnail changes on the stage when I click on different frames.

    Yes, as you say, I would like the larger image (in my library) to show in the myLayer.

    I presume that I can add text to correspond with this larger image? I am asking this, because I would not want the same text to appear alongside all the different images, otherwise I will have a photo of Marilyn Monroe next to text on, say beauty creams, and the same text next to another image of, say, a waterfall - if you see what I mean?

    Many thanks for your kind help.

    Steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •