0 Replies Latest reply on Aug 17, 2006 3:02 PM by DIY_Lobotomy

    Trying to "clean up" some code...

    DIY_Lobotomy Level 1
      Hello. I, admittedly, am not the most competent in AS. Here is a link to a .FLA where I tried to make a basic 4-question quiz:

      http://al-i.anixter.com/TEMP/SampleQuestions.fla (357kb)

      I wanted two things out of this:

      1) To make it work (which I have)

      2) To make as clean/condensed code as possible (which I think I have not!)

      I have commented the code VERY well, so it should be easy to follow my logic. But I just think I overdid stuff. Basically, each question is on a frame, and once I got one question working, I just copied-and-pasted the entire AS into the next three question-frames and changed some initial variables (which are all noted with a "// ::CHANGE:: \\" comment)...

      I was wondering if anyone could look at this and offer suggestions. One thing in particular that I'd like to get around (and I know it's possible, but I don't know how) is the "q1" variable that you will see (or q2, q3, q4, depending on the question). There's gotta be a way that I can incorporate it into the call of the "submitAnswer" function I created so that I don't have to keep replacing all six instances of that variable for each new question (you'll see when you look at the .FLA), but I just don't know what to do...

      There's other things too. I'd like this to be a learning experience for me, so any help/insight that can be offered to make this script that I wrote better would be greatly appreciated. Thanks so much everyone!!!...