7 Replies Latest reply on Apr 25, 2007 9:27 AM by Greg Dove

    What is wrong?

    Nigs
      I am a novice and admit that I am really struggling. So, what do I want to do? I have created a slideshow where the user can go forwards and backwards but I also wnat the user to be able to go back to the beginning at any point. I have got my manuals out and searched but nothing is working. The code I am using is

      stop();
      //start button
      start_btn.onRelease = function() {
      gotoAndStop("start");
      };

      I have also tried using just frame 1 as opposed to the frame label I have assigned.

      I am also experiencing an error message with this code (the back button)

      stop();
      //back button
      back_btn.onRelease = function() {
      prevFrame();
      };

      However it still works OK and people who have tested the slideshow have reported no errors.

      I would be grateful if anyone could offer any advice.
        • 1. Re: What is wrong?
          MurMeeKeer Level 1
          Hi,

          Attach your code to the objects and not to the frames. (Use on(release) handler for the buttons instead of start_btn.onRelease=function())
          • 2. Re: What is wrong?
            Nigs Level 1
            I thought that I had attached the script to the buttons (objects)? I tried to use on(release) handler and I got errors where there were none before. I have tried uploading the Flash file but this is also failing to upload.
            • 3. Re: What is wrong?
              MurMeeKeer Level 1
              It's working just fine for me. I don't know where you are missing.
              • 4. Re: What is wrong?
                Nigs Level 1
                I have just uploaded the file I am working on. This is to be the basis from which all the others will work from.

                The file is www.ultimate-top-trumps.co.uk/WWII_Warships3.zip

                I am completely new to Flash and Actionscript but I want to desperatley understand it and use it to display my collection.
                • 5. What is wrong?
                  Greg Dove Level 4
                  Do these things:

                  Remove the code that is attached to back_btn directly. (click the button and then look in your actionscript window..delete what's there.)



                  In the properties panel rename your start button

                  start_btn (instead of start)

                  To tidy things up I recommend creating a new layer called 'actions'. Remove all your other frame code that's currently on 3 separate frames (and cut and paste what's below )

                  put the following code on the first frame of actions

                  stop();
                  //start button
                  start_btn.onRelease = function() {
                  gotoAndStop(1);
                  };

                  //back button
                  back_btn.onRelease = function() {
                  prevFrame();
                  };


                  //next button
                  next_btn.onRelease = function() {
                  nextFrame();
                  };


                  A comment on actionscript that is directly attached to objects: Its a matter of personal preference whether you use this older on (release) style of event handling on objects, but its not recommended as a good practice in general. Your code is tidier and easier to understand if its all in one place.

                  Don't take my word for it:
                  http://livedocs.adobe.com/flash/8/main/00001657.html#280921
                  • 6. Re: What is wrong?
                    Nigs Level 1
                    Thanks GWD!

                    The name of the Start button that I mis-named I should have picked up, doh!

                    Everything else is experience in my case being disabled I cannot get to classes. So, thank you so much for putting me right and the advice (I know others have mentionedit as well) regarding an actions layer and even when I have dowloaded a few tutorials I see action all together on their own layer.

                    Anyway, enough of my babbling! Thank you very much!

                    • 7. Re: What is wrong?
                      Greg Dove Level 4
                      You're welcome