9 Replies Latest reply on Jun 26, 2010 2:06 PM by tom_servo3000

    Unfamiliar ActionScript

    tom_servo3000

      Hi guys,

       

      I've recently been given a canned Flash template from which I'm supposed to build a site off of for a friend/client.  I studied some AS2 a while back but most recently AS3.  Anyway, this Flash template has AS scattered all over the place and I'm not exactly sure what some of it does exactly and/or if it might be AS1.

       

      I was hoping that someone could help me decifer what some of the following code does as well as what version of AS it is so I can either work with it or wipe it out and re-script.

       

      onClipEvent(load) {....}

       

      onClipEvent(enterFrame){...}

       

      _root.soundStatus = "on";

       

      _root.mySound = new Sound(_level0);

       

      if (_root.soundStatus=="on"){step=5}

       

      on(releaseOutside, rollOut) {gotoAndPlay(20-_currentframe);}

       

      unloadMovieNum(2);

       

       

      Any and all help is much appreciated.

       

      Thanks,

      David

        • 1. Re: Unfamiliar ActionScript
          kglad Adobe Community Professional & MVP

           

          onClipEvent(load) {....}  // code that executes when this movieclip loads

           

          onClipEvent(enterFrame){...}  // code that repeatedly executes

           

          _root.soundStatus = "on";   // a variable on the _root timeline, soundStatus, is assigned "on"

           

          _root.mySound = new Sound(_level0);  // a sound instance, _root.mySound, is initialized

           

          if (_root.soundStatus=="on"){step=5}  // if _root.soundStatus is = to "on", assign the variable step to be 5

           

          on(releaseOutside, rollOut) {gotoAndPlay(20-_currentframe);}  // on releaseouside or rollout, goto and play that frame

           

          unloadMovieNum(2);  // unload the swf loaded into _level2

           

           


          • 2. Re: Unfamiliar ActionScript
            tom_servo3000 Level 1

            You rock, kglad!  Thanks.

             

            2 questions:

             

            Do these methods fall under ActionScript 1 or 2?

             

            Can I mix different versions of ActionScript in a single file?

             

             

            Thanks again!

            -David

            • 3. Re: Unfamiliar ActionScript
              kglad Adobe Community Professional & MVP

              you can mix as1 and as2 (but neither can be used with as3).

               

              most of that (attaching code to objects) is as1 and should be avoided.  there's never a reason to attach code to objects and plenty of reasons to not attach to objects.

              • 4. Re: Unfamiliar ActionScript
                tom_servo3000 Level 1

                Good to know.  OK, real quick, just going back to a few previous lines of code you defined for me....

                 

                _root.soundStatus = "on";   // a variable on the _root timeline,  soundStatus, is assigned "on"

                 

                _root.mySound = new Sound(_level0);  // a sound  instance, _root.mySound, is initialized

                 

                if  (_root.soundStatus=="on"){step=5}  // if _root.soundStatus is = to "on",  assign the variable step to be 5

                 

                 

                I'm having trouble locating these variables/instance names inside the .fla file that I'm dealing with.  They have to be in the code somewhere, right?  The one I'm especially unsure about though is the second line since, from what I understand, a sound symbol doesn't have any physical appearance on the stage so I wouldn't know where to look for an instance name assigned to it.

                • 5. Re: Unfamiliar ActionScript
                  kglad Adobe Community Professional & MVP

                  none of the variables would be on-stage.

                   

                  you can use movie explorer to find all places where each of those variables are used.

                  • 6. Re: Unfamiliar ActionScript
                    tom_servo3000 Level 1

                    Finding where the variables are used via the movie explorer is pretty straightforward, but none of them have the instance names that I'm looking for attached to them.  If you're interested, I can send you the file privately (since it's not publicly available) to see if you can locate where the sound instance names are used.

                    • 7. Re: Unfamiliar ActionScript
                      kglad Adobe Community Professional & MVP

                      i generally don't download and correct files unless i'm hired.   if that interests you, send me an email via www.kglad.com

                       

                      otherwise, all variables (among other things) are listed in movie explorer.

                      • 8. Re: Unfamiliar ActionScript
                        tom_servo3000 Level 1

                        Noted for future reference.  I'll let you know.  Thanks.

                        • 9. Re: Unfamiliar ActionScript
                          kglad Adobe Community Professional & MVP

                          you're welcome.

                           

                          but i'd recommend double checking movie explorer and make sure all options are checked.  i've never seen movie explorer miss a variable occurance.