472,141 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

need some help - flash quiz

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
1 3006
rsdev
149 100+
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.

Similar topics

2 posts views Thread by Carolyn Gill | last post: by
16 posts views Thread by C++ Hell | last post: by
1 post views Thread by saytri | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.