flash xml quiz

Out of context: Reply #2

  • Started
  • Last post
  • 4 Responses
  • 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

View thread