# ===================================================================== # comptarebour.sc - r2g (16 juin 2007) # 1) linux - swfc comptarebour.sc # 1) windows - c:\program files\swftools>swfc c:/lin_site/20070605-01/comptarebour.sc # ===================================================================== .flash name=comptarebour.swf bbox=301x151 background=white version=6 compress .box cadre width=300 height=150 color=#4273ED fill=none .font myfont "garamond.swf" .edittext infoHh text="##" color=blue font=myfont size=50% width=50 height=25 wordwrap border variable=textvarHh .edittext infoMm text="##" color=blue font=myfont size=50% width=50 height=25 wordwrap border variable=textvarMm .edittext infoSs text="##" color=blue font=myfont size=50% width=50 height=25 wordwrap border variable=textvarSs .put infoHh pin=center 50 25 # 75 50 .put infoMm pin=center 130 25 # 150 50 .put infoSs pin=center 210 25 # 225 50 .action: var monStyle = new TextFormat(); monStyle.align = "center"; monstyle.size = 15; // 45 infoHh.setnewTextFormat(monStyle); infoMm.setnewTextFormat(monStyle); infoSs.setnewTextFormat(monStyle); var decrementeOn = false; var incrementeOn = false; // variables Timing // --------------------- var textvarHh = 0; var textvarMm = 0; var textvarSs = 0; var DixHeure = 0; var Heure = 0; var DixMinute = 0; var Minute = 0; var DixSeconde = 0; var Seconde = 0; var Compteur = 0; var resteOp = 0; function UpdateChrono() { DixHeure = ((textvarHh - (textvarHh % 10)) / 10); Heure = (textvarHh % 10); DixMinute = ((textvarMm - (textvarMm % 10)) / 10); Minute = (textvarMm % 10); DixSeconde = ((textvarSs - (textvarSs % 10)) / 10); Seconde = (textvarSs % 10); Compteur = ((DixHeure*36000)+(Heure*3600)+(DixMinute*600)+(Minute*60)+(DixSeconde*10)+(Seconde*1)); } var monComptarebour = setInterval (decrementeCompteur, 1000); var monChronometre = setInterval (incrementeCompteur, 1000); createTextField('chronometre',2,15,35,400,55); formatChrono = new TextFormat(); formatChrono.color = 0x0000FF; formatChrono.font = 'sans'; formatChrono.size = 50; chronometre.text = "00:00:00"; chronometre.setTextFormat(formatChrono); function afficheChrono () { chronometre.text = "" + DixHeure + Heure + ":" + DixMinute + Minute + ":" + DixSeconde + Seconde; chronometre.setTextFormat(formatChrono); } function calculCompteur () { dixHeure = math.floor (argCompteur / 36000); resteOp = argCompteur - (dixHeure * 36000); Heure = math.floor (resteOp / 3600); resteOp = resteOp - (Heure * 3600); dixMinute = math.floor (resteOp / 600); resteOp = resteOp - (dixMinute * 600); Minute = math.floor (resteOp / 60); resteOp = resteOp - (Minute * 60); dixSeconde = math.floor (resteOp / 10); Seconde = resteOp - (dixSeconde * 10); } function decrementeCompteur () { if (decrementeOn) { if (Compteur > 0) { Compteur -= 1; argCompteur = Compteur; calculCompteur (); afficheChrono (); } else { decrementeOn = false; incrementeOn = true; } } } function incrementeCompteur () { if (incrementeOn) { Compteur -= 1; argCompteur = (Compteur - (Compteur * 2)); calculCompteur (); formatChrono.color = 0xFF0000; afficheChrono (); } } .end # *************** # buttons definitions # *************** .outline o_stop: M 00.000000,10.000000 L 00.000000,00.000000 L 10.000000,00.000000 L 10.000000,10.000000 L 00.000000,10.000000 .end .outline o_pause: M 00.000000,10.000000 L 00.000000,00.000000 L 03.000000,00.000000 L 03.000000,10.000000 L 00.000000,10.000000 M 6.000000,10.000000 L 6.000000,00.000000 L 9.000000,00.000000 L 9.000000,10.000000 L 6.000000,10.000000 .end .outline o_arrow: M 00.000000,10.000000 L 00.000000,00.000000 L 10.000000,5.000000 L 00.000000,10.000000 .end .filled stop_idle outline=o_stop fill=#3366ff color=navy line=1 .filled stop_hover outline=o_stop fill=#336699 color=salmon line=2 .filled stop_pressed outline=o_stop fill=#4466ff color=red line=2 .filled pause_idle outline=o_pause fill=#3366ff color=navy line=1 .filled pause_hover outline=o_pause fill=#336699 color=salmon line=2 .filled pause_pressed outline=o_pause fill=#4466ff color=red line=2 .filled arrow_idle outline=o_arrow fill=#3366ff color=navy line=1 .filled arrow_hover outline=o_arrow fill=#336699 color=salmon line=2 .filled arrow_pressed outline=o_arrow fill=#4466ff color=red line=2 .button inputime .show arrow_idle as=idle .show arrow_idle as=shape .show arrow_hover as=hover .show arrow_pressed as=pressed .on_release: UpdateChrono (); afficheChrono (); .end .end .button stop .show stop_idle as=idle .show stop_idle as=shape .show stop_hover as=hover .show stop_pressed as=pressed .on_release: decrementeOn = false; incrementeOn = false; formatChrono.color = 0x0000FF; UpdateChrono(); afficheChrono (); .end .end .button pause .show pause_idle as=idle .show pause_idle as=shape .show pause_hover as=hover .show pause_pressed as=pressed .on_release: decrementeOn = false; .end .end .button play # .show arrow_idle as=idle .show arrow_idle as=shape .show arrow_hover as=hover .show arrow_pressed as=pressed .on_release: decrementeOn = true; .end .end # *************** # affichage # *************** .put cadre 0 0 .put inputime pin=center x=265 y=25 scalex=200% scaley=200% rotate=90 .put stop pin=center x=50 y=120 scalex=400% scaley=400% .put pause pin=center x=130 y=120 scalex=400% scaley=400% .put play pin=center x=210 y=120 scalex=400% scaley=400% .end