10 Replies Latest reply on May 29, 2008 1:22 PM by Ned Murphy

    I need HELP!!

    Suzy Creighton
      I am currently working on a website in Flash CS3 using AS2 and can't seem to get my site to work properly. I would really appreciate someone's help!! I have set up my site using frame labels and I have 3 buttons per page (company, portfolio and contact). My frames are intro, introOut, company, companyOut, portfolio and portfolioOut. I'm trying to get my buttons onPress to play the "Out" frames and then to go to the proper area that was pressed (for instance on the intro section when you press the company button it would play the introOut section first then go to the company section and play and stop at the end of the company section). I have the different button instances in each area, right now at the end of the intro section I have included my code below.

      Company plays okay... but on the portfolio button it doesn't play the introOut... UGH!! HELP!! I've tried using a var and nextSection... I don't know what I need to do... I think it's gotta be something simple but I can't seem to work it out.

      Thanks!!
        • 1. Re: I need HELP!!
          kglad Adobe Community Professional & MVP
          in your button handler assign a variable to store the frame label that should play after the outro finishes. on the last frame of your outros execute a goto that uses that variable.
          • 2. Re: I need HELP!!
            Suzy Creighton Level 1
            would you mind giving me an example of what both should be?

            Thanks... I new to this and trying to figure it out ; o
            • 3. Re: I need HELP!!
              Suzy Creighton Level 1
              I'm really trying to get this... now it's playing the introOut but it only goes to the company section after... can you help me?? I know I'm a moron and very new to this... this is my first entire site in flash and I'm just about ready to pull my hair out!! HELP!! I think I've got the code all messed up at this point.

              • 4. Re: I need HELP!!
                Ned Murphy Adobe Community Professional & MVP
                I can't be sure how your timeline is set up, so to expand (hopefully) on what kGlad was telling you to do. Create a variable that spans the entire timeline (no interruptions of other coded frames along that layer... you may have one such layer already in place). Let's call it:

                var nextSection:String;

                Then, assign the value of the new section's frame label to that variable from your button handler function(s):

                portfolio_btn.onPress = function() {
                nextSection = "portfolio_1";
                gotoAndPlay("introOut");
                };

                Then, in the very last frame of your introOut section, make the call to move to the new section:

                gotoAndPlay(nextSection);

                If the introOut section happens to be a self-contained movieclip that occupies a single frame on the main timeline, rather than being constructed along the same timeline as the other sections, then you would use a _parent reference for that line of code (_parent.gotoAndPlay(_parent.nextSection))
                • 5. Re: I need HELP!!
                  Suzy Creighton Level 1
                  okay... I think I've competely messed this all up...
                  my timeline is setup with each individual section in a folder and follows this type of sequence for each section: intro and introOut sections. The next folder is the company and companyOut info. It starts at the frame after the introOut. Each folder has it's own label layer and actions layer... should I only have one label layer and one actions layer at the very top of my entire timeline? When you say one layer that spans the entire timeline with no interruptions of other coded frames along that layer... should it be placed where in the timeline? Does it matter, top or bottom? do I put the
                  var nextSection:String;
                  on the first frame and then have a keyframe in the very last frame of the entire timeline of that layer?

                  I guess I'm just learning all the terminology as well because I would take it to mean that I place the:

                  portfolio_btn.onPress = function() {
                  nextSection = "portfolio_1";
                  gotoAndPlay("introOut");
                  };

                  on the frame with the portfolio_btn and then on the last frame of introOut the action:

                  gotoAndPlay(nextSection);

                  I didn't create separate movieclips for the "Outs" they are in the timeline and are a reverse transition of the previous sections so I don't need to reference the _parent.

                  Are you completely confused now? I had tried the labels and actions layer only at the top and I've had the code exactly as you have it written but I know I don't have it placed where it's supposed to go. I keep trying to work with the just the intro section because I know once I FINALLY get this baby working it's just a matter of applying it to the other sections with their proper instances and labels.

                  I can't tell you how much I appreciate your help... I've keep looking in the help section and it seem most of the references deal with numeric instances and I haven't been able to find anything about the variables and frame labels... THANKS!!!
                  • 6. Re: I need HELP!!
                    Ned Murphy Adobe Community Professional & MVP
                    I'm not all that confused with your description.

                    First, create a layer at the top of the timeline for the nextSection var... no special reason other than I always try to keep code up top. Only the first frame of that layer should be occupied, with the var nextSection:String; In doing that across the entire timeline everything in the timeline below it has access to it. If you were to put another keyframe in that layer it would break that access to antything down the line.

                    As for the rest of it, I think what you take it to mean is what I mean. If there are multiple outros, they will all have access to the nextSection variable, so the button code you show will be valid. And at the end of each outro, that gotoAndPlay(nextSection) will send things on their way to where you want to go.

                    Just a note, hopefully not to confuse you: for what you showed originally in your first posting, the last gotoAndPlay call will always win out. Code is executed much much faster than any timeline travels. So, while the first gotoAndPlay might have started thinking about heading down the timeline, the second was the equivalent of changing its mind and going somewhere else.
                    • 7. Re: I need HELP!!
                      Suzy Creighton Level 1
                      I'm gonna go give it a shot... would you mind if I asked you another question/s... is it better to have my actions and labels at the top of my timeline... or is it okay to have them in the separate sections? One more... what is a good book to have on hand to reference for this? It's amazing to me how much time this kind of thang can take... LOL!!

                      I really DO appreciate your help... you've been a lifesaver. I'll let you know how it turns out and check that this has been answered after I go try it out ; )

                      THANKS!!!!
                      • 8. I need HELP!!
                        Ned Murphy Adobe Community Professional & MVP
                        You can divide things up in whatever way suits you. Myself, I prefer to use 4 separate layers for coded/typed stuff: actions, vars, functions, and labels. It's just easier for me to find things that way. But as I said, whatever works best for you.

                        I don't know any good books... and I hate reading (making it odd that I write so much though). I've pretty much learned Flash via pursuing projects, scrutinizing the Flash help documentation, and searching online... and I've plenty left to learn. Nowadays I'm using the forum as a learning tool... see an interesting (or simple) problem and try to help solve it.

                        What you oughta do is make a new posting asking about which books are good... be sure to indicate what version of actionscript you are interested in. You'll probably get a few worthy suggestions.
                        • 9. Re: I need HELP!!
                          Suzy Creighton Level 1
                          woo hoo!! it's working!!

                          Thank you very much... I was literally about to pull my hair out. I knew I had the code I needed I just didn't know where to place it ; )

                          You're very right... I'm just learning as I go and each project has it's own set of conflicts. This is my first entire site in Flash... up to this point I had just been creating elements and placing them into my webpages. In keeping with that, they gave me the confidence to try this. I'm already thinking about my next site I have to do.

                          Maybe you should think about writing a book. You really explained everything in an understandable fashion!!

                          Thanks again!!
                          • 10. Re: I need HELP!!
                            Ned Murphy Adobe Community Professional & MVP
                            You're welcome. Write a book, hmmm... I would probably have to read it in the process, so I probably couldn't get thru writing it.