Tuesday 12 October 2010

Coding my quiz into Flash

The development work that I have covered during the lesson:
During this lesson I started and finished coding my quiz in flash. To do this I had to open a pre-coded document, i then had to edit the code so that the quiz would display my questions and my answers. To do this I had to delete the text that was stored in the speech marks, i then had to replace this text with my questions and answers. I then tested the quiz to see if it worked correctly, I then had to save this document in the same folder as the rest of my flash work. I then had to go into my front end document and then insert a declaration that was coded in the pre-coded document. I had to modify the declaration so that I when i clicked on the 'Quiz' button on the extras section the quiz would then load. I then had to enter a function and event piece of code, this is where I entered the SWF. name of the quiz into the speech marks of the code. I then tested to see if the quiz loaded properly and everything worked fine which it did.
The small piece of code below is the declaration piece of code. This piece of code is telling the program that from screen3, when the quiz button ( or btnquiz) is clicked, the program should load the Quiz..
frmScreen3.btnquiz.addEventListener(MouseEvent.CLICK,openQuiz);
The second piece of code shown below is the subroutine that i entered into my flash project. This piece of code is asking the program to run an event, the event it is asking it to run is to open the quiz file 'openQuiz(evt:Event). The next line of code is then asking the program to locate the file that is trying to be opened, in this case this is the ("Quiz.swf"); the swf that the file is trying to open is the quiz that i have created in a separate flash project and is trying to link he two projects together so that when the Quiz button is pressed the Quiz is then loaded on the front end flash project.
function openQuiz(evt:Event)
{
var urlReq:URLRequest=newURLRequest("Quiz.swf");
var myLoader:Loader = newLoader ();
myLoader.x=120; myLoader.y=60;
try{ removeChildAt(4);}
catch(e:Error){}
addChild(myLoader);
}

How this met the client brief:
This met the client brief as the client brief states that I must have interactive features in my front end such as a quiz. By adding the quiz to my front end I have met some of the client brief. requirements as i have added an interactive feature being the quiz.
Skill Number:
19

No comments:

Post a Comment