Skip to content

Instantly share code, notes, and snippets.

@torchofjoy
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torchofjoy/10561761 to your computer and use it in GitHub Desktop.
Save torchofjoy/10561761 to your computer and use it in GitHub Desktop.
stop();
import fl.controls.RadioButtonGroup;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.ui.Mouse;
//Timer
var myTimer:Timer=new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, countdown1);
function countdown1(event:TimerEvent):void{
konte.text=60-myTimer.currentCount+"";
if (myTimer.currentCount==61){
gotoAndStop(6);
}
}
myTimer.start();
//score
var myscore=0; score2.text=myscore+"";
//group radio buttons
var mygroup1:RadioButtonGroup=new RadioButtonGroup("group1");
a1.group=a2.group=a3.group=a4.group=a5.group=mygroup1;
//button ok
bok.addEventListener(MouseEvent.CLICK, nextquiz);
function nextquiz(event:MouseEvent):void{
if (mygroup1.selection.label=="Menmenm")
{
myscore+=10; nextFrame(); good.visible=true; bad.visible=false;
}
else
{
nextFrame();good.visible=false; bad.visible=true;
}
}
var timer:Timer = new Timer(1000); // creating a new instance of the timer class
timer.addEventListener(TimerEvent.TIMER, timerHandler)
function timerHandler(event:TimerEvent){
sneedle.rotation+=6;// 6 degree rotation evey second
//mneedle.rotation+=6/60;// minute hand runs 60 times slower than seconds hand
//hneedle.rotation+=6/60/12;// hour needle runs 12 times slower than minute needle
// toFixed(2) will cause only 2 digits to appear after the decimal point
second.text=(timer.currentCount)+"";
//minute.text=(timer.currentCount/60).toFixed(2)+"";// 60 s in a m
//hour.text = (timer.currentCount/60/60).toFixed(2)+""//60 mins in an hr
}
timer.start();
//group radio buttons
var mygroup2:RadioButtonGroup=new RadioButtonGroup("group2");
an1.group = an2.group = an3.group = an4.group =an5.group=mygroup2;
score2.text=myscore+"";
//button ok
bok2.addEventListener(MouseEvent.CLICK, nextquiz2);
function nextquiz2(event:MouseEvent):void{
if (mygroup2.selection.label=="Torchon")
{
myscore+=10; nextFrame(); good2.visible=true; bad2.visible=false;
}
else
{
nextFrame();good2.visible=false; bad2.visible=true;
}
}
//group radio buttons
var mygroup3:RadioButtonGroup=new RadioButtonGroup("group3");
anm1.group = anm2.group = anm3.group = anm4.group = anm5.group = mygroup3;
score2.text=myscore+"";
//button ok
bok3.addEventListener(MouseEvent.CLICK, nextquiz3);
function nextquiz3(event:MouseEvent):void{
if (mygroup3.selection.label=="Rakete")
{
myscore+=10; nextFrame(); good3.visible=true; bad3.visible=false;
}
else
{
nextFrame();good3.visible=false; bad3.visible=true;
}
myTimer.stop();
timer.stop();
}
score2.text=myscore+"";
bok4.buttonMode=true;
bok4.addEventListener(MouseEvent.CLICK, nextquiz4);
function nextquiz4(event:MouseEvent):void{
nextFrame();
}
timer.stop();
myTimer.stop();
score2.text=myscore+"";
bok4.addEventListener(MouseEvent.CLICK, nextquiz5);
function nextquiz5(event:MouseEvent):void{
gotoAndStop(7);
/*if (myTimer.currentCount==59){
myTimer.stop();
sneedle.rotation+=0;
timer.stop();
}
else if (myTimer.currentCount>59)
{
myTimer.stop();
sneedle.rotation+=0;
timer.stop();
}
else {
myTimer.start();
sneedle.rotation+=6;
timer.start();
}
*/
}
stop();
if (myTimer.currentCount==60){
myTimer.stop();
}
else if (myTimer.currentCount>60)
{
myTimer.stop();
}
stop();
myTimer.start();
if (myTimer.currentCount==50){
gotoAndStop(6);
}
timer.start();
sneedle.rotation+=6;
if (myTimer.currentCount==47){
gotoAndStop(6);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment