Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import flash.display.MovieClip;
- import flash.text.TextField;
- import flash.text.TextFormat;
- import flash.events.Event
- import flash.media.SoundChannel;
- import flash.events.MouseEvent;
- public class countdownCode extends MovieClip{
- public function countdownCode() {
- var bell:temple = new temple();
- var cNum:Number;
- cNum = 10;
- //keep track of the frame we're on
- var fNum:Number;
- fNum=0;
- var resetButton:reset = new reset ();
- addChild(resetButton);
- resetButton.x=270
- resetButton.y=380
- resetButton.height=40
- resetButton.width=90
- resetButton.buttonMode=true
- //text
- var t:TextField = new TextField ();
- addChild(t);
- t.x=255
- t.y=10
- t.text = String(cNum)
- t.width = 500
- t.height=500
- //changing text properties
- var tf:TextFormat = new TextFormat ();
- tf.size=40
- tf.font = "Comic Sans MS";
- tf.color= 0xFFFFFF
- //put the text field and text format together!!
- t.setTextFormat(tf);
- //clock arms
- var c:clock = new clock
- addChild(c);
- c.x=275;
- c.y=200;
- c.width=5
- addEventListener(Event.ENTER_FRAME, mainFun);
- function mainFun(e:Event):void {
- fNum++; //fNum+=1
- c.rotation +=15
- if (fNum == 24){
- cNum--
- t.text = String(cNum)
- t.setTextFormat(tf);
- //reset fNum back to 0 every second (24 f/s)
- fNum=0
- //make the temple bell go when the clock hits zero
- if (cNum == 0){
- var myChannel2:SoundChannel = bell.play();
- t.visible = false
- c.visible = false
- }
- resetButton.addEventListener(MouseEvent.CLICK,resetButtonFun);
- function resetButtonFun (e:MouseEvent):void {
- cNum = 10;
- if (cNum==10){
- t.visible = true
- c.visible = true
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement