Fireball Clock

Fireball Clock is a demo using TeraClock and TeraFire.

  • width presents hours.
  • height presents minuts.
  • color presents seconds.

source code is here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 *  Copyright 2008 tarotarorg(http://tarotaro.org)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.tarotaro.flash.display
{
    import com.trick7.effects.TeraFire;
    import com.trick7.utils.TeraClock;
    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.events.Event;
 
    /**
     * ...
     * @author tarotarorg
     */
    [SWF(width="120", height="600", backgroundColor="0xFFFFFF", frameRate="30")]
    public class BurningClock extends Sprite
    {
        private var _clock:TeraClock;
        private var _fire:TeraFire;
        private var _fx:Number;
        private var _fy:Number;
        private var _fw:Number;
        private var _fh:Number;
 
        public function BurningClock()
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
 
        private function init(e:Event = null):void
        {
            this.stage.scaleMode = StageScaleMode.NO_SCALE;
            this._fx = this.stage.stageWidth / 2;
            this._fy = this.stage.stageHeight * 0.95;
            this._fw = this.stage.stageWidth / 24;
            this._fh = this.stage.stageHeight / 45;
            this._clock = new TeraClock(9);
            this._clock.addEventListener(TeraClock.SECONDS_CHANGED, secondChanged);
 
            this._fire = new TeraFire(this._fx,
                                      this._fy,
                                      (this._clock.hours + 1) * this._fw + 1,
                                      (this._clock.minutes + 1) * this._fh + 5,
                                      ((0xFF-this._clock.hours) <<16) | (this._clock.minutes <<8) | this._clock.seconds * 4,
                                      (this._clock.seconds <<16) | (this._clock.minutes <<8) | this._clock.hours);
            this.addChild(this._fire);
        }
 
        private function secondChanged(e:Event):void
        {
            this._fire.changeFire(
                                      (this._clock.hours + 1) * this._fw + 1,
                                      (this._clock.minutes + 1) * this._fh - 5,
                                      ((0xFF-this._clock.hours) <<16) | (this._clock.minutes <<8) | this._clock.seconds * 4,
                                      (this._clock.seconds <<16) | (this._clock.minutes <<8) | this._clock.hours);
        }
    }
}
Ads

Ad

Ad

Share

  • Add this article to hatena bookmark
  • 60

Follow

Ads

Ad

Comments

  1. psybermoon says:

    nice fire FX but it comes an error on line 65
    dont find Method changeFire

    private function secondChanged(e:Event):void
    {
    this._fire.changeFire(
    (this._clock.hours + 1) * this._fw + 1,
    (this._clock.minutes + 1) * this._fh – 5,
    ((0xFF-this._clock.hours) <<16) | (this._clock.minutes <<8) | this._clock.seconds * 4,
    (this._clock.seconds <<16) | (this._clock.minutes <<8) | this._clock.hours);
    }

  2. tarotarorg says:

    Hi, psybermoon.

    Please use this file.
    http://www.libspark.org/svn/as3/TeraFire/branches/tarotarorg/src/com/trick7/effects/TeraFire.as

    This is a branch of TeraFire.as which I made.

    Thank you.

  3. Flash Clock says:

    That’s a ingenious action script code applied in a flash clock, i have to consider your clock to be a great work.

    Please share the fla file, i would like to see how it was created, i just need to see the actionscript to learn how to made it, thanks.

  4. tarotarorg says:

    Hi, Flash Clock.

    I have no fla file.
    I use Flex SDK and compile .as file.

    Thank you.

  5. Flash Clocks says:

    I do not work with flex, yet, though i pan to, i already have the flex program and AIR, so if you could provide the source code and tell me how to compile the as, i think i can do it, thanks for the clock. Send to my e-mail if you can.

    You say flex SDK, that is the open source flex is it not? How can i compile as in flex swd in PC?

    Thank you for your response, that is not something that always happens in topics, i appreciate you took some free time to answer my request.

  6. tarotarorg says:

    Hi, Flash Clocks.

    I installed Flash CS4 trial to my Mac and create fla file for this.
    Please download from:
    http://flash.tarotaro.org/sample/FireballClock.zip

    Thank you.

Leave a Comment

Your email address will not be published. Required fields are marked *