7 Replies Latest reply on May 14, 2009 5:43 PM by Ned Murphy

    start timeline when I click button

    Spalding H Level 1

      I'm new to flash, and I need a little help getting started. I have used the actions panel to write a stop code on frame one of my timeline.When I test my movie it stays on the home page, which is good! I have also created an 'enter site' button on the home page. I want to click this button and have the timeline start rolling over to frame 50 (where my next label 'contents' will be). At frame 50 I want it to stop, and so on for all of my labels/pages. The action taking place on the timeline is a pan across a panoramic photograph, which will stop at different points.

       

      cheers,

      Spaldo

        • 1. Re: start timeline when I click button
          Ned Murphy Adobe Community Professional & MVP

          Code your button to play();  If you don't know how to code a button yet, indicate which version of actionscript you are using and an example can be provided (or someone can take the time to explain all the possibilities)

          • 2. Re: start timeline when I click button
            Spalding H Level 1

            Thanks Ned.

             

            I haven't learned to code buttons yet. I looked in the help menu for some codes, but I found it

            confusing. If anyone could show me a good place to find tutorials on coding buttons, I would be

            grateful.

             

            S

            • 3. Re: start timeline when I click button
              Ned Murphy Adobe Community Professional & MVP

              All's I need to know is what version of actionscript you plan to be using and I'll provide you a quick solution, possibly an explanation too.  If you don't know what version of AS you're using, check the Flash section of your Publish Settings.  If you don't know where your Publish Settings are, find them via the File option on the main toolbar.... and if it took telling you all that to get there... you oughta spend some time digging around the menu options of Flash and learn what's where and stuff.  The Help documents can be really handy as well.

              • 4. Re: start timeline when I click button
                Spalding H Level 1

                sorry. It's actionscript 3.0.

                 

                I've made an attempt. This is what I have:

                 

                home_btn.addEventListener (MouseEvent.CLICK, buttonClicked);

                 

                function buttonClicked (event: MouseEvent) : void

                 

                {

                gotoAndStop (50)

                }

                 

                stop();

                 

                 

                It goes to the frame I want, but it doesn't play the timeline. It just goes there automatically.

                • 5. Re: start timeline when I click button
                  Ned Murphy Adobe Community Professional & MVP

                  Instead of ...

                   

                  gotoAndStop(50);

                   

                  use...

                   

                  play();

                   

                  OR...

                   

                  gotoAndPlay(2);

                   

                   

                  Note: unpredictably, sometimes the timeline needs an extra push, so if that change does play out, put a play(); command in frame 2 for added incentive.

                  • 6. Re: start timeline when I click button
                    Spalding H Level 1

                    Thank you, Ned!

                     

                    By the way... If I want the clicked button to fade away before the timeline rolls on to the next page, would it be best to

                    do this by writing a code which makes the button disappear and then the timeline plays, or just to do it all in the timeline?

                    i.e maybe have 50 frames where the button alpha goes from 100 - 0%, then on frame 50 make the background start rolling to the new page.

                    Or would it be better to write a code?

                     

                    Thanks for your help

                    • 7. Re: start timeline when I click button
                      Ned Murphy Adobe Community Professional & MVP

                      You can do it either way, though if you're not familiar/comfortable with doing it in a coded manner, you may want to stick with the timeline approach.

                       

                      There's a posting I just answered in the AS3 forum that gives an example of the coded approach, though it deals with the rotation property.  You'd want to use the alpha property instead.  Here's a link to that posting... you'd only need to deal with the last line in the moveIt function:

                       

                      http://forums.adobe.com/thread/433193?tstart=0

                       

                      One thing you should do as well, assuming you don't want the user to use that button again once it starts moving down the timeline. In the button event handler you can add:

                       

                      home_btn.removeEventListener (MouseEvent.CLICK, buttonClicked);

                      1 person found this helpful