PDA

View Full Version : Quiz Template with Images / Flash / Video



pbohorq
12-16-2008, 05:44 AM
I need to use the Quiz Template but I need each question to show an image or flash or video depending on the question.

How can I modify the .quiz file to have it show an image/flash/video for each question?

TJ_Tigger
12-16-2008, 09:19 AM
If it were me I would look at adding a line into the XML file that references the object that you want to show for each question. For instance I would use the following

<multimedia type="flash">path-to-file</multimedia>

Then when you load the question I would check for the type of multimedia and then get the file name and load it into the appropriate object.

pbohorq
12-16-2008, 10:24 AM
Thank you.

I'm using the quiz template from AMS 7.5. I dont really know how to insert this line of code and where in the application the video will show. How can I insert the image/video/flash into the page and the info into the file sample.quiz that has all the questions information.


This template has only 2 pages: one where the questions appears and one with the final information after completing the quiz.

Also tried with a file that I downloaded from the forum

Multiple_Choice_XML_Quiz This one uses a combo box for the answers and uses an xml file.

I'm really new with this.

TJ_Tigger
12-16-2008, 11:23 AM
Here is one way to accomplish this task This uses an image/video/flash object on the same page to play/show the component. The quiz has questions with and without the files so you can see how it works if you have a mixed quiz.

I added this to the Populate Quiz function on the Global functions page


--check for multimedia file
Image.SetVisible("Image1", false);
Flash.SetVisible("Flash1", false);
Flash.Stop("Flash1");
Video.SetVisible("Video1", false);
Video.Stop("Video1");
local strtype = XML.GetAttribute(strXMLPath.."/multimedia", "type");
local strFile = XML.GetValue(strXMLPath.."/multimedia");
--Dialog.Message(strtype, strXMLPath.."\r\n"..strFile);
if strtype == "video" then
if File.DoesExist(_SourceFolder..strFile) then
Video.SetVisible("Video1", true);
Video.Load("Video1", _SourceFolder..strFile, true, false);
end
elseif strtype == "flash" then
if File.DoesExist(_SourceFolder..strFile) then
Flash.SetVisible("Flash1", true);
Flash.Load("Flash1", _SourceFolder..strFile, true, true);
end
elseif strtype == "image" then
if File.DoesExist(_SourceFolder..strFile) then
Image.SetVisible("Image1", true);
Image.Load("Image1", _SourceFolder..strFile);
end
end

this just looks for the multimedia compnent for a question and if it exists it will play/show the appropriate object.

Here is the structure of the XML file with the added multimedia component(see red lines below).


<item>
<question type="mc">What number comes immediately after 1?</question>
<multimedia type="image">/AutoPlay/Images/post-it.png</multimedia>
<answer correct="y">2</answer>
<answer>3</answer>
<answer>4</answer>
<answer>5</answer>
</item>
<item>
<question type="mc">What number comes immediately after 2?</question>
<multimedia type="flash">/AutoPlay/Flash/globe.swf</multimedia>
<answer correct="y">3</answer>
<answer>5</answer>
<answer>6</answer>
<answer>7</answer>
</item>
<item>
<question type="mc">What number comes immediately after 3?</question>
<multimedia type="video">/AutoPlay/Videos/Magnolia.mpg</multimedia>
<answer correct="y">4</answer>
<answer>7</answer>
<answer>9</answer>
<answer>1</answer>
</item>

project file attached using the sample files from AMS for flash, video and images. replace with appropriate content.

HTH
Tigg

TJ_Tigger
12-16-2008, 11:27 AM
The alternate method I thought about using was to have the multimedia content displayed in a DialogEx window. I may try to post an example of this later, but don't have the time now to play with it. I think this would be a cleaner way (and more fun) to display those objects.

Tigg

pbohorq
12-16-2008, 02:18 PM
Thank you. I will try and let you Know.

Once again thanks

anilmjn
11-07-2009, 01:22 AM
Please, how to save the selected answers.........................

anilmjn
11-07-2009, 02:02 AM
please, help me.
How to save the selected answers...................

TJ_Tigger
11-07-2009, 02:38 PM
In the example the selected answers are stored in the XML with the attribute of selected='y'. You could modify the function that checks for the correct answers and have it output the selected answers to a table or string that could then be output to an HTMl file or you could save it as a CSV.

HTH