A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 26

Thread: Frame buttons

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Unhappy Frame buttons

    I'm terrible at Actionscript no matter what version it is. Call me a bad programmer and everything.

    I'm made my slide show (something to do with the video game franchise F-Zero) for Web Page Design class and I'm nearly completed. All I have to do is make some buttons that lets you go to either the next or previous frame. I done so but every time I do such, I keep getting these Syntax errors (I don't remember what they were). Now my brain cells are mushed and I deleted the buttons and now I don't know what to do. I have to get it finished by tomorrow (or Friday if schools closed tomorrow due to February Fury; I doubt it).

    I'm terribly sorry for saying this, but can anyone make a button for me? I've searched on Google yet no solution. Would credit make you feel any better?

    Download link: http://rapidshare.com/files/34863602...eshow.fla.html

  2. #2
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Anyone interested?

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    I really don't know how to use action script.

  4. #4
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    I'm in a bind here guys.

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    I can't do actionscript that great.

  6. #6
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You probably didn't get any responses since this thread was posted when most of the members are asleep.

    To make a movieclip do something when you click it, you need to add an event listener for MouseEvent.click to it.

    If you next button has the instancename "nextButton", and the next slide frame has the label "nextSlideLabel" then this code will make your movie advance when you click the button.

    Code:
    nextButton.addEventListener(MouseEvent.CLICK, goForward);
    
    function goForward(e:MouseEvent):void{
      gotoAndStop("nextSlideLabel");
    }
    To go backward, if your previous slideLabel was "prevSlide", then just use that as the argument to gotoAndStop.

  7. #7
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    You probably didn't get any responses since this thread was posted when most of the members are asleep.

    To make a movieclip do something when you click it, you need to add an event listener for MouseEvent.click to it.

    If you next button has the instancename "nextButton", and the next slide frame has the label "nextSlideLabel" then this code will make your movie advance when you click the button.

    Code:
    nextButton.addEventListener(MouseEvent.CLICK, goForward);
    
    function goForward(e:MouseEvent):void{
      gotoAndStop("nextSlideLabel");
    }
    To go backward, if your previous slideLabel was "prevSlide", then just use that as the argument to gotoAndStop.
    I kinda got stumped after making the "nextButton".

  8. #8
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Where are you stumped?

    I take it you have a movieclip on a frame somewhere named "nextButton".

    In the actions for that frame, put the code above. Name your frames appropriately.

  9. #9
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    Where are you stumped?

    I take it you have a movieclip on a frame somewhere named "nextButton".

    In the actions for that frame, put the code above. Name your frames appropriately.
    What I was saying is, "Where should I put the code at? On the frame outside the button or inside the button?"

  10. #10
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Frame outside that button.

  11. #11
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    Frame outside that button.
    http://rapidshare.com/files/34921964...48894042592467

    Now I'm getting errors that are telling me that I have duplicate layers. Can you check and see what I did wrong?

  12. #12
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    No, I can't. I don't have Flash installed on my work computer.
    If you mean duplicate label, then you've probably tried to actually label your frames prevSlideLabel and nextSlideLabel on more than one frame. Labels must be unique. I just used those to illustrate how to go to a particular frame.

  13. #13
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    No, I can't. I don't have Flash installed on my work computer.
    If you mean duplicate label, then you've probably tried to actually label your frames prevSlideLabel and nextSlideLabel on more than one frame. Labels must be unique. I just used those to illustrate how to go to a particular frame.
    You have it at home? Oh! Okay. I'll try.

  14. #14
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    No, I can't. I don't have Flash installed on my work computer.
    If you mean duplicate label, then you've probably tried to actually label your frames prevSlideLabel and nextSlideLabel on more than one frame. Labels must be unique. I just used those to illustrate how to go to a particular frame.
    OK. Done what you said, but now my movie won't stop. where should I put the "stop;" action code at?

  15. #15
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    If you used gotoAndStop, it shouldn't continue playing. I suppose you could put stop() in the actions for the destination frame.

  16. #16
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    If you used gotoAndStop, it shouldn't continue playing. I suppose you could put stop() in the actions for the destination frame.
    So I should put the "stop();" code on top of the other code, right? Or would it screw up?

  17. #17
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    It should go at the top of the destination frame(s). stop() doesn't prevent code from executing, it only prevents the playhead from advancing. So it shouldn't screw anything up.

  18. #18
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    It should go at the top of the destination frame(s). stop() doesn't prevent code from executing, it only prevents the playhead from advancing. So it shouldn't screw anything up.
    Didn't work.

    My code:
    Code:
    stop();
    nextButton.addEventListener(MouseEvent.CLICK, goForward);
    
    function goForward(e:MouseEvent):void{
      gotoAndStop("nextSlideLabel");
    }
    I've definitly done something wrong. May have something to do with the layers.

  19. #19
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    There's definitely something wrong. gotoAndStop should prevent it from advancing once it's gone to the other frame on its own. But you put stop on the wrong frame. I meant the destination frame - the one that you are going to. Which in this case is nextSlideLabel.

    If you are not already, use the debug player. Report any error messages that you are getting.

  20. #20
    Junior Member
    Join Date
    Jan 2010
    Posts
    18
    Quote Originally Posted by 5TonsOfFlax View Post
    There's definitely something wrong. gotoAndStop should prevent it from advancing once it's gone to the other frame on its own. But you put stop on the wrong frame. I meant the destination frame - the one that you are going to. Which in this case is nextSlideLabel.

    If you are not already, use the debug player. Report any error messages that you are getting.
    I already put those codes in those frames [the ones labeled "nextSlideLabel(#)"].

    I forgot to mention my layers:
    Music: For background music.
    Text: For storytelling.
    Images: My drawings to illustrate to story.
    Preloader: Newgrounds preloader.

Tags for this Thread

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