3 Replies Latest reply on Sep 5, 2006 6:21 AM by 2m

    Any code-checkers out there?...

    DIY_Lobotomy Level 1
      I'm aware that this question is going to come off as very vague, but it's difficult to ask a specific question when I'm not sure exactly what I'm looking for!...

      I am a relatively basic ActionScripter. I spent time creating a 5-question quiz with my own code (not using the quiz templates). Everything works perfectly fine, but (being a novice in AS) I'm sure there is a LOT of unnecessary code that I wrote...

      I was wondering if anyone with more experience can just scan over this .FLA for me and let me know if anything jumps out at you. It is HEAVILY commented, so it should be easy to follow my "programming logic". Basically it is set up like this (with all AS residing only in the frame scripts):

      FRAMES 1 & 3 - single-answer multiple choice question
      FRAMES 2 & 4 - multiple-answer multiple choice question
      FRAME 5 - results screen

      Here is the link to the .FLA - thanks in advance to any help that anyone can offer! I'm just trying to learn...

      http://al-i.anixter.com/TEMP/SampleQuestions.fla

        • 1. Re: Any code-checkers out there?...
          2m Level 2
          Hi,

          I took a quick look at your code and it seems pretty ok to me. I coulnd't find anything that stood out, but I didn't look too closely I admit.

          If you want to optimize you coding my tip would be to try to go from your "frame by frame" based approach to a more global approach using AS2 classes.

          If that sounds like a too big step to you by now, you could also try using actionscript1 and generating your screen content dynamically.

          Usually this can be done using only the first frame.

          Don't get me wrong, there is nothing wrong with using frames, but in your case it could be a good exercise trying to produce more flexible code, that probably could read the questions fron an outside xml...

          Markus
          • 2. Any code-checkers out there?...
            DIY_Lobotomy Level 1
            Thanks for the tips, Markus!...

            I think that having the questions loaded outside from XML is definitely a doable option for me to try and work on...

            Also, I considered creating all the stage objects dynamically, but does that save on file size at all once the .SWF is published? I didn't think that mattered much, but if it does than I'll definitely work on that as well...

            Thanks again! If anyone else can think of anything, please let me know!!!....
            • 3. Re: Any code-checkers out there?...
              2m Level 2
              Hi,

              creating the content at runtime probabply won't save a lot of byte size, but you will gain a lot flexibility.
              If done right, the number of options is collected from the xml, and you don't hafe to build frames for every question, but you just show the current question, the the next, and if there is no next you solve the quiz....
              Get the idea?
              BTW: by saying create them dynamically I didn't mean drawing them with the drawing api, but attaching them from the library...