By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,508 Members | 1,823 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,508 IT Pros & Developers. It's quick & easy.

need some help - flash quiz

P: 1
Hi there,
i'm trying to develop a quiz in flash.
Searching on the net, I found a quiz in flashkit from sephiroth.it by Alessandro Crugnola.
His quiz has a script that puts the questions and the answers in random order.
What i'm looking for is to not select the answers by clicking the mouse, but using the keyPress handler.
Using the keyPress handler the script selects only the first answer
I tried a lot but i didn't find any solution..
2 hours ago, I thought that I found a solution using if(this._name=="answer1") but it works only with the "on(release)" handler, when I replace it with the on(keyPress) the script selects again only the first answer...
Any help would be much appreciated...

this is the link where you could d/l the quiz:
http://www.flashkit.com/movies/Applications/Multiple-sephirot-5192/index.php

and below is the btn source.

Thank you in advance.



on(release){
if(this._name=="answer1")
{
if(!_root.Done){
point._visible = 1
_root.myChoice = thisChoice; // choice
removePoints(_name,this); // remove other points
// making the coice
trace(_root.myChoice);
if(_root.myChoice != undefined){
_root.Done = true;
_root.totalAnswer++;
if(_root.myChoice){
giusta._visible = 1
_root.correctAnswer++
}
// displaing right & wrong answers
if(!_root.myChoice){
errata._visible = 1
}
if(_root.totalAnswer == _root.toDisplay){
_root.aspetta.itsEnd = true
_root.aspetta.play();
} else {
_root.aspetta.play();
}
delete _root.myChoice;
}}
}
}
Nov 3 '07 #1
Share this Question
Share on Google+
1 Reply


100+
P: 149
Hi there,
i'm trying to develop a quiz in flash.
Searching on the net, I found a quiz in flashkit from sephiroth.it by Alessandro Crugnola.
His quiz has a script that puts the questions and the answers in random order.
What i'm looking for is to not select the answers by clicking the mouse, but using the keyPress handler.
Using the keyPress handler the script selects only the first answer
I tried a lot but i didn't find any solution..
2 hours ago, I thought that I found a solution using if(this._name=="answer1") but it works only with the "on(release)" handler, when I replace it with the on(keyPress) the script selects again only the first answer...
Any help would be much appreciated...

this is the link where you could d/l the quiz:
http://www.flashkit.com/movies/Applications/Multiple-sephirot-5192/index.php

and below is the btn source.

Thank you in advance.



on(release){
if(this._name=="answer1")
{
if(!_root.Done){
point._visible = 1
_root.myChoice = thisChoice; // choice
removePoints(_name,this); // remove other points
// making the coice
trace(_root.myChoice);
if(_root.myChoice != undefined){
_root.Done = true;
_root.totalAnswer++;
if(_root.myChoice){
giusta._visible = 1
_root.correctAnswer++
}
// displaing right & wrong answers
if(!_root.myChoice){
errata._visible = 1
}
if(_root.totalAnswer == _root.toDisplay){
_root.aspetta.itsEnd = true
_root.aspetta.play();
} else {
_root.aspetta.play();
}
delete _root.myChoice;
}}
}
}
Hi Korr,

I would suggest using an listenerobject to check for a key press. Something like this.

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch(Key.getCode()){
case "80" : //key pressed is P
//do something when P is pressed
break;
}
};
Key.addListener(keyListener);
Nov 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.