5 Replies Latest reply on Oct 17, 2008 11:16 AM by kglad

    Replay Button troubles...

    SteFLuV
      Hello Everyone!

      I am in need of some assistance with attaching the actionscript to replay my movie (and the music to go along with it).

      This is what I have done:

      1. My button has been created. I just don't know where to put the actionscript.

      2. I'm using Flash CS3.

      Any response will be fine. Basically I just need to know where to put the actionscript for this replay button.

      Thank you so much!!! :)
        • 1. Re: Replay Button troubles...
          Level 7
          Code should go in one place only - in a script layer on the main timeline.

          Give your button an instance name - like myButton.

          Then you can do:

          myButton.onRelease = function(){
          gotoAndPlay(1);
          stopAllSounds();
          }

          --
          Dave -
          www.offroadfire.com
          Head Developer
          http://www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          • 2. Re: Replay Button troubles...
            kglad Adobe Community Professional & MVP
            the code you showed should be attached to a button or movieclip.
            • 3. Re: Replay Button troubles...
              SteFLuV Level 1
              Hello,

              I know that it needs to be attached to the button or movie clip, but when I try to edit the button and add the action script, it doesn't allow me to do so.

              Which screen do I need to be in to attach this code? I keep getting syntax errors when I try to attach the code in the movie clip.

              Thanks.
              • 4. Re: Replay Button troubles...
                SteFLuV Level 1
                Hi,

                I am still having trouble attaching the code.

                This is what I am doing:

                1. Like I said before, the button has been created.

                2. now from what i've been reading, you can only attach the script to the main timeline of the movie, however I only want to attach the code to the button and I cannot.

                3. Something I did try was copying a replay button from another movie into the movie i'm working on now. When I go to test the movie, I get this error:

                WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.

                I really want to get this accomplished today, any help is appreciated. Thank you all so much.

                This is the code that is attached to the copied replay button from the previous movie:
                • 5. Re: Replay Button troubles...
                  kglad Adobe Community Professional & MVP
                  your publish settings are set for as3. you can't apply code to objects in as3.

                  if you want to change your publish settings and publish for as2, click on file/publish settings/flash and change the actionscript dropdown to as2. you'll then be able to apply your code to your button/movieclip.