13 Replies Latest reply on Jul 6, 2007 5:09 PM by kglad

    AS 2.0 Problems

    Lakhonian
      hi guys

      I am hoping some one can help me out here.

      I'm building my portfolio/resume in Flash, and i am having a real big headach getting teh actionscript to navigat from one frame to another with the buttons. i.e the stop(); code works fine on its own, but i want to get the slider to go from i.e frame 52 to frame 78 in the same scene, and i am not having any luck.

      when i sit the code in the frame with the button on it, i have no errors, only that the script isn't working.
      If i sit the actionscript in the button, it throws up an error telling me that there should be a pre-defined status (I'm literally program deficient lol)

      i've looked around already and i've tried exisitng examples but i haven't had any joy whatsoever, sdo if anyone can help me it would be much appreciated.
        • 1. Re: AS 2.0 Problems
          kglad Adobe Community Professional & MVP
          first, label your frame 52. 2nd, you'll simplify your coding if you put a stop in frame 78 of that scene.

          you can then use:

          • 2. Re: AS 2.0 Problems
            Lakhonian Level 1
            hey Kglad

            on your code that you have offered I'm looking at the ("frame58_scene3") bit of code, I can see where the frame58 part comes into play, but can you maybe expand on the "_scene3" part.

            The reason for this is all the information is going to be selfcontained within one rather large scene (if need be i might have to seperate it into scenes), so im curious as to the function of the "_scene3" part of the "gotoAndPlay" operator.

            thanks in advance
            • 3. Re: AS 2.0 Problems
              kglad Adobe Community Professional & MVP
              that was an example because you mentioned scenes and i thought you might have several frame number 58's. the string name used to label a frame is irrelevant. it's just a name.

              if you have one scene, then you have one less problem with which to deal. simply label that frame using whatever string you find helpful and use that string in your gotoAndPlay() method.
              • 4. Re: AS 2.0 Problems
                Lakhonian Level 1
                Its me again lol

                tried your code and as i refer to what i said earlier i dont have a head from programming/action script.

                however i did use the offered code, and unfortunately i have encountered an error, and the error thrown up is the following:
                **Error** Scene=Scene 1, layer=Dramatis, frame=271:Line 1: Statement must appear within on handler
                dramatis.onPress=function(){


                its worth noting that all the buttons in the scene stop at frame 271 where there is a stop command on a seperate layer so that the user can browse through the different sections (you can see for yourself in the file i've put up so you guys can see where my dilemma is at.

                I have also placed my file on the following site so that if need be, you can look at it and see where im going wrong (in this instance terribly)

                Flash Portfolio

                • 5. Re: AS 2.0 Problems
                  kglad Adobe Community Professional & MVP
                  don't attach that code to an object. attach it to a frame where dramatis exists.
                  • 6. Re: AS 2.0 Problems
                    Lakhonian Level 1
                    quote:

                    Originally posted by: kglad
                    don't attach that code to an object. attach it to a frame where dramatis exists.


                    ok well i've attached the code to the frame itself where the button exists (its a single frame in line with the ' stop();' command).
                    the code:

                    dramatis.onPress = function() {
                    // <- make sure you use the instance name of your button instead of yourButton.
                    _root.gotoAndPlay("frame299_dramatis1");
                    // <- label this frame
                    };


                    is placed in the frame where the button sits (everything is named so that i can find them easily). however i have one niggling problem.

                    The code checker tells me that the code is correct and working properly - however when i run the preview to see if work this is where i have the problem. the movie runs till the stop command in the single frame and when i press the button to move on to the next series of frames, it refuses to wrok, as if there is another stop command preventing it from running.

                    this is a problem i had encountered previously with javascript and even though the code was correct it refused to operate.

                    anything to help? am i doing something so wrong i cant even see it cos its so basic or am i just defunct at writing actionscript?

                    • 7. Re: AS 2.0 Problems
                      kglad Adobe Community Professional & MVP
                      if that code fails to work you either

                      1. don't have a movieclip/button with instance name dramatis that exists when the code is executed or

                      2. you don't have a frame labeled frame299_dramatis1 on the _root timeline.

                      check your spelling and check for upper case/lower case mismatches.
                      • 8. Re: AS 2.0 Problems
                        Lakhonian Level 1
                        you know now that i think about it.. the buttons are all held in a set folder in the time line, they aren't on the main timeline itself
                        • 9. Re: AS 2.0 Problems
                          kglad Adobe Community Professional & MVP
                          then you need to use the correct path to dramatis. something like:

                          mc1.mc2.dramatis.onPress=function(){
                          ...
                          }

                          // where dramatis is on mc2's timeline and mc2 is on mc1's timeline and mc1 is on the timeline that contains that code.
                          • 10. Re: AS 2.0 Problems
                            Lakhonian Level 1
                            ah i see..

                            well in anycase before i read your reply i went back and moved the information back to the main timeline out of the folders, and tried the code again yet still no joy.

                            I've attached a link to a screenshot so you can see where things are and where the code is, in addition i hope it makes it a little clearer for you cos sometimes my explanations can be jumbled and long winded at times.



                            http://i18.photobucket.com/albums/b127/Mac-Gallery/flashproblem.jpg
                            • 11. Re: AS 2.0 Problems
                              kglad Adobe Community Professional & MVP
                              i don't see a frame labeled frame299 on the _root timeline.
                              • 12. Re: AS 2.0 Problems
                                Lakhonian Level 1
                                wow..
                                i..

                                it works!

                                i went in and took a look at the root set and then at the code then it hit me..i don't know why i never saw it before...

                                but in anycase
                                I'd like to sayt thank you to yourself kglad for putting up with my queries and nonsense. but thanks to you and the sudden kick in my *** when you pointed it out in your last post it now works.

                                thanks a whole lot! ^.^
                                • 13. Re: AS 2.0 Problems
                                  kglad Adobe Community Professional & MVP
                                  you're welcome.