|

How do I... ?

AnswerList of Questions


Make a Basic Quiz/Testing Application


As an example, we will create a two page test, and a third page to display the results:


1. Create a project with three pages.


2. Insert the following code in the Global Functions:


--Each of the following tables contains a question, and 4 answers: Q_01 = {Question="How many legs does a three leg'd dog have?", A1="One", A2="Two", A3="Four", ACorrect="Three"};

Q_02 = {Question="How many legs does a one leg'd cat have?", A1="Three", A2="Two", A3="Four", ACorrect="One"}; Correct={Q1="",Q2=""};


image

3. On Page1, create one paragraph object, and four button objects.


4. In the On Preload event of Page1, insert the following code:


image

Paragraph.SetText("Paragraph2", Q_01.Question); Button.SetText("Button1", Q_01.A2); Button.SetText("Button2", Q_01.A1); Button.SetText("Button3", Q_01.ACorrect); Button.SetText("Button4", Q_01.A3);


5. Insert the following code into the On Click event of Button1:


image

Correct.Q1 = "InCorrect"; Page.Navigate(PAGE_NEXT);


6. Insert the following code into the On Click event of Button2:


image

Correct.Q1 = "InCorrect"; Page.Navigate(PAGE_NEXT);


7. Insert the following code into the On Click event of Button3:


image

Correct.Q1 = "Correct"; Page.Navigate(PAGE_NEXT);


8. Insert the following code into the On Click event of Button4:


Correct.Q1 = "InCorrect"; Page.Navigate(PAGE_NEXT);


image

9. On Page2, create one paragraph object, and four button objects.


10. In the On Preload event of Page2, insert the following code:


image

Paragraph.SetText("Paragraph2", Q_02.Question); Button.SetText("Button1", Q_02.A3); Button.SetText("Button2", Q_02.A2); Button.SetText("Button3", Q_02.A1); Button.SetText("Button4", Q_02.ACorrect);


11. Insert the following code into the On Click event of Button1:


image

Correct.Q2 = "InCorrect"; Page.Navigate(PAGE_NEXT);


12. Insert the following code into the On Click event of Button2:


image

Correct.Q2 = "InCorrect"; Page.Navigate(PAGE_NEXT);


13. Insert the following code into the On Click event of Button3:


image

Correct.Q2 = "InCorrect"; Page.Navigate(PAGE_NEXT);


14. Insert the following code into the On Click event of Button4:


image

Correct.Q2 = "Correct"; Page.Navigate(PAGE_NEXT);


15. Create one paragraph object on the last page of your project.


image

16. Insert the following code into the On Preload event of the last page:


string_correct=""; correct = 0;

possible = 0;

for j,k in pairs(Correct) do possible = possible + 1; if k == "Correct" then

correct = correct + 1;


end

end


Paragraph.SetText("Paragraph2",

"Question 1: " .. Correct.Q1 .. "\r\n" ..

"Question 2: " .. Correct.Q2 .. "\r\n" ..

"You answered correctly " .. correct .. " out of " .. possible .. " possible questions for a score of " .. ((correct/possible)*100) .. "%."

);


How do I... ?


AnswerList of Questions


image

Make a Document Browser


As an example, we will create an application that has the user select a folder on his drive, and then populates a listbox object with all of the *.doc files within that directory. The user clicks on a file in the listbox object, and clicks the "Open" button to open the document.


1. Create a project with one listbox object, and two button objects.


2. Label Button1 "Load" and Button2 "Open".


image

3. Insert the following code into the On Click event for Button1:


--Disable listbox Updating ListBox.SetUpdate("ListBox1", false);


--Get the desired folder to browse

folder = Dialog.FolderBrowse("Open Folder", "C:\\");


--populate a table with all the .doc files

file = File.Find(folder, "*.doc", false, false, nil);


--do the following for each file: for j,file_path in pairs(file) do

--add the item to the listbox, with the name visible and path as data

ListBox.AddItem("ListBox1", String.SplitPath(file_path).Filename, file_path); end


--Allow the listbox to display the updated content ListBox.SetUpdate("ListBox1", true);


4. Insert the following code into the On Click event for Button2:


selected = ListBox.GetSelected("ListBox1"); for j,k in pairs(selected) do

File.Open(ListBox.GetItemData("ListBox1", k),"", SW_SHOWNORMAL);

end


image

image

How do I... ?

AnswerList of Questions


Make a Dropdown Menu


To create a dropdown menu in AutoPlay Media Studio:


1. Create a project with six label objects, and arrange them as follows:


image


image

2. Insert the following code into the On Click event of Label1:


if visible then Label.SetVisible("Label2", false); Label.SetVisible("Label3", false); Label.SetVisible("Label4", false); Label.SetVisible("Label5", false); Label.SetVisible("Label6", false); visible = false;

else

Label.SetVisible("Label2", true); Label.SetVisible("Label3", true); Label.SetVisible("Label4", true); Label.SetVisible("Label5", true); Label.SetVisible("Label6", true); visible = true;

end


3. Insert the following into your Global Functions:


visible = false;


image

image

How do I... ?

AnswerList of Questions


Make a Slideshow


image

Tip: AutoPlay Media Studio 8 now contains a SlideShow object that can also be used for this functionality.


The purpose of a slideshow is to display images at a predetermined rate. In AutoPlay Media Studio, this is accomplished by creating a project with one page per image you wish to display.


1. On every page in your project, create one image object containing the appropriate image.


2. Create the following action in the On Show event of every page in your project:


Page.StartTimer(5000); --fires the timer once every 5 seconds.


image

3. Create the following action in the On Timer event of every page in your project:


Page.Navigate(PAGE_NEXT);


image

The only page that does not have this action is the last page, because there are no more pages to jump to.


image

4. Create the following action in the On Show event of your last page:


Page.StopTimer(); --stops the timer


image

Note: The On Timer and On Show events are found by right-clicking on a blank space on the page and choosing Actions.


image

|