A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: image viewer problems

  1. #1
    Member
    Join Date
    Jun 2002
    Posts
    50
    I'm trying to make an image viewer where the control of the 7 images is via 7 different buttons; however, I want the images to fade in and out between each other, not just appear.
    Now the problem is, how do I make, say button 4 to show picture 4 when I was just looking at 7 and make the transition look right? I'm I just asking too much? I tried everything that I can think of and I can’t seem to figure it out.

    Now if I am asking too much, then how about using just 2 buttons to view back and forth? Can that be done because I can’t figure that one out?

    I look forward to your suggestions. Thanks.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Since you didn't mention wanting to use dynamically loaded images, I'll assume you don't want to. Which is good, because it'll make this easier.

    Put each image into a separate movie clip, first frame is blank with a stop action, the rest of the frames have the image fading up, with a stop on the last frame. Stack all the clips on top of each other on the stage, and give them instance names like image1, image2, etc.

    Set up a variable for the depth of the images (i.e. to bring the clicked image to the front). Something like newDepth=10.

    Then you can put code like this on each button:

    on (release) {
    image1.swapDepths(newDepth);
    image1.gotoAndPlay(2);
    newDepth++;
    }


    Or add a function to the main timeline:

    function newImage(selected) {
    selected.swapDepths(newDepth);
    selected.gotoandPlay(2);
    newDepth++;
    }

    and then each button would have code like this:

    on (release) {
    newImage(image1);
    }

    That should at least get you started.

  3. #3
    Member
    Join Date
    Jun 2002
    Posts
    50
    Do I make a mc (as in a new symbol) of each image fading up seperately with a stop at the front and the end then on the last frame I put in newDepth =10, then stack all these mc's on top of one another? Or do I make one movie clip with all the fades on different layers.

    Where do I put the "newDepth=10"? at the end of each image or clip?

    Thanks for you help.

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Yes, new symbol for each one.

    Put newDepth=10 on the main timeline, not in the clips.


  5. #5
    Member
    Join Date
    Jun 2002
    Posts
    50
    Ok done. But, Im not clear on where/how exactly I put "newDepth=10".

    Here's the script I'm using for my button whic is the host clip for the clip that has all the images:

    on (rollOver) {
    _root.comz5.pf1.gotoAndPlay("mouseover");
    }
    on (rollOut) {
    _root.comz5.pf1.gotoAndPlay("mouseout");
    }
    on (release) {
    p2_root.comz5.pixiefade.p2.swapDepths(newDepth);
    p2_root.comz5.pixiefade.p2.gotoAndPlay(2);
    newDepth++;
    }


    comz = host clip
    pf1 = my animated button
    p2 = #2 pic fade

    I think I have this linked up right.... But I said,I still cant figure out where exactly do I use the "newDepth=10".

    Sorry for being duh.

  6. #6
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Well you're increasing newDepth (newDepth++) to make sure that each time a clip fades in, it fades in above the previous clip. 10 is just an arbitrary number that should be above the depths of all the clips on start, since there is only 7 of them.

    The main timeline of the Flash movie should only need one frame, so just put it on the first frame. The only thing that's important here is that it's being set to 10 once. From then on it'll be 11, 12, etc.

  7. #7
    Member
    Join Date
    Jun 2002
    Posts
    50
    I'm Sorry.
    I dont get it... I think my brain is dead.

    Can you explain a bit more? I still dont get it.

  8. #8
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Well from the looks of your code you're making it WAY more complicated than it needs to be. I'm also getting the impression you may not have fully explained what you want the movie to do.

    Is it not working, or is it working and you don't understand why?

  9. #9
    Member
    Join Date
    Jun 2002
    Posts
    50
    Its not working yet and I dont know why. What I am trying to do is, inside a movie clip (host) after the 1st image is seen, 7 buttons appear below. Then I want the viewer to click on the buttons to switch from one image to another via the buttons. I want the images to fade in and out of each other, not just pop up.
    So the problem is how do I tell the buttons to go to which picture? I made small MCs containing just 1 image fading in and out and MCs with all images fading in and out and another MC witch contains all the smaller clips in it, one on top of another, all of which dont work.

    I tried a bunch of things (hence all the different MCs - I was trying to "guess" what it would take to make it work) including what you suggested.

    I totally lost! I feel that there gotta be a smiple way...similar to the way where you make them just appear.


  10. #10
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    http://www.richarddoyle.net/mxtests/viewer.fla

    Quick and dirty, but you should be able to understand it.


  11. #11
    Member
    Join Date
    Jun 2002
    Posts
    50
    That's it!!! Thats exactly what i was trying to do.
    Now lets see if I can understand it.

    Thank you.

  12. #12
    Member
    Join Date
    Jun 2002
    Posts
    50
    I got that to work for the first set of images which contained 7 pics.

    Now I cant seem to make it work for these two other sets of images that contain 2 pics each. I made different instances and 2 new sets of grouped buttons like before but its not working.

    Also I cant seem to get my button rollover to work now. I would like the "active" button to play a small clip when the mouse rolls over it. I tried to make an extra frame with the buttons that annimate in it to see if that would make the buttons annimate and it does; however, there viewer wont work.

    Any ideas? Thanks.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center