3 Replies Latest reply on Aug 13, 2009 9:20 PM by btk_ola

    seeking basic script help

    btk_ola

      hello flash forum-

      i will start with my question and leave the explanation for later...

       

      i am looking for real simple scripting- i have a 15-25 frame flash tweened animation, and all i would like to do is run thru the animation once then on mouse click go to frame one and start again... and of course i am under a time crunch and completley fogged with actionscript 3.0

       

      yes, i did some basic projects back in the director days and thought i could just pick up where i left off... if i remember right it was simple scripting like

      gotoFrame

      and

      pause

      etc... sheeesh! do i feel lame! thanks very much in advance for any and all help

        • 1. Re: seeking basic script help
          thepixelsmith Level 2

          This is a two part solution. First stop the timeline from automatically playing again and then create an event listener that allows you to run a function based on a mouseClick.

           

          In the last frame of your timeline:

           

          Step 1: Create a stop function

           

          stop();

           

          Step 2: Create an Event Listener to listen for a MouseClick. This assumes you want to have a button trigger the playback. I used a generic name and assumed that you were using a MovieClip as the button.

           

          myMC_mc.addEventListener(MouseEvent.MOUSE_DOWN, myFunction);

           

          Step 3: Create the function that is listed at the end of the event listener. It will be triggered whenever the listener runs.

           

          function myFunction(myEvent:MouseEvent):void {

               gotoAndPlay(1);

          }

           

           

          If you don't want to use a button you could use an event listener tied to the stage itself:

           

          stage.addEventListener(MouseEvent.MOUSE_DOWN, myFunction);

          • 2. Re: seeking basic script help
            Ned Murphy Adobe Community Professional & MVP

            Repeated info removed

            • 3. Re: seeking basic script help
              btk_ola Level 1

              thank you very much! soon as i get this out im hittin the books!

               

              thanks again

              btk