flash xml quiz

  • Started
  • Last post
  • 4 Responses
  • OBBTKN

    Hi, i´m preparing a flash demo with different activities on them, one of them, is a quiz (text paragraphs with 2 different options selectable on it). Something like this:

    Can anybody point to a tutorial or example on how to do this? I´ve googled around and i did´nt found anything helpfull.

    It need to be done in as2+xml

    Thanks

  • monNom0

    can "XML" be html formatted text? If so you could then use an A HREF to call an internal flash function with your selection as an argument.

    e.g. asfunction:myfunction(argument)

    that ought ot be the simplest way

  • fyoucher10

    what monNom said but a more complete example would be:

    In your xml, create the HTML for the questions 'but' you have to format it for special characters.
    I'll type an example here but it won't gather here properly since this forum will just add ellipses if there aren't any spaces between words...

    // Take out extra spaces and comments for this to work correctly, /especially all of the extra spaces around the asfunction.

    //Format is:
    asfunction:functionName , functionParameter (which is optional) ... which means you can just call the function without an argument like
    asfunction:functionName.

    //Start XML node
    <question1>

    &lt;
    A HREF =
    "asfunction: questionFunction, question1Answer"

    &gt;

    Do cows like beef jerky?

    !&lt;
    /A
    &gt;

    //End XML node
    </question1>

    In Flash just write a simple function (you might want to make it a global function to make it easier for yourself. Just keep in mind that asfunction's parameter option is a String value.

    Here's the Flash function.
    It's using a switch statement which would be easy to use for all of the questions:

    _global.questionFunction =
    function( questionArgument:String ):Void {
    switch ( questionArgument ) {

    case "question1Answer":
    //Actionscript to execute for question 1
    break;

    case "question2Answer":
    //Actionscript to execute for question 2
    break;

    //etc, etc, etc, repeat case for other questions

    default: break;
    }
    }

    • Oh yeah and make sure the TextField has HTML selected...fyoucher1
  • vaxorcist0

    man.. this would be soooo easy to do in HTML or even jquery/ajax/php/whatever compared to reinventing the browser i Actionscrapped!

    • this is sooooo easy to do in flash... just gotta know what you're doing just like you'd have to if using what you saidPonyBoy
  • OBBTKN0

    ^ yes, i know, it´s easy to be done in html, but i need it integrated in a CD-ROM project with other Flash MCs, etc... thanks for your help