A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Code review...

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    21

    Code review...

    Greetings folks!

    Pretty new at this actionscript thing and wanted to get some feedback if possible. I'm planning on building a quiz that is going to utilize drag/drop functionality. Playing around with some possible elements, this is some basic code I've come up with (not the final look at all...)

    What I would like to know from you is this:

    - How would you modify this code to make it perhaps less bulky?
    - How would you apply this type of code to a quiz with multiple questions?

    Thanks for any insight you can provide...

    // Intialize Feedback movies
    feedback_mc._visible = false;

    ball_mc.onPress = function () {
    this.startDrag();
    this._alpha = 75;
    };

    ball_mc.onRelease = function () {
    this.stopDrag();
    var overlap:Boolean = this.hitTest(hitTest_mc);
    if (overlap) {
    ball_mc._visible = false;
    info_txt.text = "Great job! You're so smart.";
    feedback_mc.gotoAndStop(2);
    correctAnswers();
    tally();
    }else{
    hitTest_mc.gotoAndStop(2);
    ball_mc.gotoAndStop(2);
    feedback_mc._visible = true;
    feedback_mc._x = 24;
    feedback_mc._y = 145;
    wrongAnswers();
    tally();
    }
    };

    // Answer tally functions

    wrongAnswers = function () {
    wrong = wrong + 1;
    };

    correctAnswers = function () {
    correct = correct + 1;
    score_mc.score_txt.text = correct;
    };

    tally = function () {
    score_mc.tally_txt.text = (correct/10)*100 + "%";;
    };

    // Initialize Variables

    var correct:Number = 0;
    var wrong:Number = 0;
    Attached Files Attached Files

  2. #2
    See-n-reMember azwaldo's Avatar
    Join Date
    Mar 2003
    Location
    Sonoran Desert
    Posts
    745
    do you use XML?
    here is a demo made some time ago...does it look neighborhoodly?
    __azwaldo__

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center