Actionscript 2.0 でクイズを作成しています。クイズは8問。各質問には 4 つの回答があり、各回答には異なるポイントが与えられます。フレームごとに 2 つの質問に答えてから、次の 2 つの質問に進みます。
私の問題は、最終的に計算されるポイントを各回答に割り当てる必要があり、ポイントの数に応じて、ユーザーをさまざまなメッセージ (フレーム) に送信する必要があることです。
これまでの私のコードは次のとおりです。
// create an array of all nav buttons in group
var groupinfo:Array = [q1a1, q1a2, q1a3, q1a4];
// create a variable to track the currently selected button
var activebtn:MovieClip;
// doRollOver: start the rollover action or process,
// unless the button is currently selected
function doRollOver() {
if (this != activebtn) {
this.gotoAndPlay(2);
}
}
// doRollOut: start the rollout action or process,
// unless the button is currently selected
function doRollOut() {
if (this != activebtn) {
this.gotoAndPlay(1);
}
}
// doClick: 1) return previously selected button to normal, 2) show visual
// indication of selected button, 3) update activebtn
function doClick() {
activebtn.gotoAndPlay(1); // return previously selected to normal
delete this.onEnterFrame; // stop activity on selected mc
activebtn = this; // update pointer to current selection
}
// assign functions to each event for each button in the group
function init() {
for (var mc in groupinfo) {
groupinfo[mc].onRollOver = doRollOver;
groupinfo[mc].onRollOut = doRollOut;
groupinfo[mc].onRelease = doClick;
}
}
init();
このコードは、各ページの回答のアクティブ状態を処理します。次の問題は、フレーム間を移動すると、これらの状態が記憶されずにリセットされることです。
//////////////////////////// ファイル: ////////////////// //////////
http://www.danielwestrom.se/quiz/quiz.html - ライブ デモ
プロジェクト ファイルの .html を .zip に変更します
ありがとう!