Eseclock

UNIQLOCK っぽい何かが作れます

コード

つかいかた

new して addChild すると UNIQLOCK っぽい何かが表示されます。このとき、文字色と背景色 (交互に切り替わります) を指定します。

addChild(new Eseclock(0x000000, 0xffffff));

extends Eseclock して createContents をオーバーライドして何かしら DisplayObject を返すようにすると、それが順々に時計の合間 (例のダンスの部分) に表示されます。

package 
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import org.libspark.eseclock.Eseclock;
	
	public class MyEseclock extends Eseclock
	{
		public function MyEseclock()
		{
			super(0xff0000, 0x0000ff);
		}
		
		override protected function createContents(w:Number, h:Number):DisplayObject
		{
			var sprite:Sprite = new Sprite();
			sprite.graphics.beginFill(0xffffff);
			sprite.graphics.drawRect(0, 0, w, h);
			sprite.graphics.endFill();
			for (var i:uint = 0; i < 40; ++i) {
				sprite.graphics.beginFill(Math.floor(Math.random() * 256), Math.random() * 100);
				sprite.graphics.drawCircle(Math.random() * w, Math.random() * h, Math.random() * 20 + 30);
				sprite.graphics.endFill();
			}
			return sprite;
		}
	}
}

ライセンス

Licensed under the MIT License

Copyright (c) 2008 BeInteractive! (www.be-interactive.org) and Spark project (www.libspark.org)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

こみった