In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

【IconBadge】Mac OS Xのバッジっぽいもの

Mac OS Xでよく見かけるバッジを真似してみました。
黒い長方形の上でマウスを動かしてみて下さい。
Get Adobe Flash player
by wetcradle 22 Apr 2010
    Embed
/**
 * Copyright wetcradle ( http://wonderfl.net/user/wetcradle )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3Q7h
 */

/**
Mac OS Xでよく見かけるバッジを真似してみました。
黒い長方形の上でマウスを動かしてみて下さい。
*/

package {
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	public class IconBadgeTest extends Sprite {
		private var iconBadge:IconBadge;
		private var rect:Sprite;
		public function IconBadgeTest():void {
			//バッジの作成
			iconBadge = new IconBadge();
			iconBadge.x = iconBadge.y = 10;
			addChild(iconBadge);
			//rectの作成
			rect = new Sprite();
			rect.graphics.beginFill(0x000000);
			rect.graphics.drawRect(0, 0, 400, 50);
			rect.graphics.endFill();
			rect.y = 100;
			rect.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
			addChild(rect);
		}
		private function mouseMoveHandler(e:MouseEvent):void {
			iconBadge.count = Math.pow(e.localX/10, 3);
		}
	}
}

import flash.display.BitmapData;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;

class IconBadge extends Sprite {
	
	private var _count:int = 0;
	private var badgeCanvas:Sprite;
	private var badge:Loader;
	private var badgeLeft:Loader;
	private var badgeCenter:Loader;
	private var badgeRight:Loader;
	private var textField:TextField;
	private var centerBitmapData:BitmapData;
	
	private const BADGE_BASE64:String = "iVBORw0KGgoAAAANSUhEUgAAADMAAAA0CAYAAAAnpACSAAAKQ2lDQ1BJQ0MgUHJvZmlsZQAAeAGdlndUU1kTwO97L73QEkKREnoNTUoAkRJ6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GfrmLhrNx9dKd5B5rnqEzAZyfK8AUHW28vZ4HxAvjto3seJMLGy/XPdDC4M08iE3Y9Fl2Hop1D+F2bLqZhw6Qr491t2I9tn2dp7/Kzrj5rC7pba5NjqtLaYlXDXHqn7TGbmmon+FB3ijQ5fsZHqXl77FvnsFQH/lJWv52SZfvY2iCw4muN0n+h/dzrJWuJPcYTdwilZlSPgWJxJ9ojCWvTUGnt1BXF5OA8cQnU106bz7dVJJWpN/ETKSFwHI7IVECaKaAgqoSmS6DLhSwV1hsn36xwKO08z+7SVQOXaXG/wYAsUU8d0kTzTYAAAAASUVORK5CYII=";
	
	private const MARGIN:Number = 12;
	
	////////////////////////////////////////////////////////////
	//////////////コンストラクタ
	////////////////////////////////////////////////////////////
	
	public function IconBadge():void {
		super();
		
		badgeCanvas = new Sprite();
		addChild(badgeCanvas);
		
		var textFormat:TextFormat = new TextFormat("Helvetica", 25, 0xffffff, true);
		textField = new TextField();
		textField.defaultTextFormat = textFormat;
		textField.autoSize = TextFieldAutoSize.LEFT;
		textField.selectable = false;
		textField.y = 12;
		textField.width = textField.height = 0;
		addChild(textField);
		
		badge = Base64ImageLoader.load(BADGE_BASE64);
		badgeLeft = Base64ImageLoader.load(BADGE_LEFT_BASE64);
		badgeCenter = Base64ImageLoader.load(BADGE_CENTER_BASE64);
		badgeRight = Base64ImageLoader.load(BADGE_RIGHT_BASE64);
		
		badge.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
		badgeLeft.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
		badgeCenter.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
		badgeRight.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
	}
	
	////////////////////////////////////////////////////////////
	//////////////プロパティ
	////////////////////////////////////////////////////////////
	
	//______________ count ______________//
	public function get count():int {
		return _count;
	}
	public function set count(value:int):void {
		if (value == _count) {
			return;
		}
		_count = value;
		refreshCount();
	}
	
	////////////////////////////////////////////////////////////
	//////////////メソッド
	////////////////////////////////////////////////////////////
	
	//______________ refreshCount ______________//
	private function refreshCount():void {
		if (!centerBitmapData) {
			return;
		}
		var prevTextWidth:Number = textField.textWidth;
		textField.text = String(Math.max(0, _count));
		if (textField.textWidth == prevTextWidth) {
			return;
		}
		badgeCanvas.graphics.clear();
		while (badgeCanvas.numChildren) {
			badgeCanvas.removeChildAt(0);
		}
		var minWidth:Number = textField.textWidth + MARGIN * 2;
		if (_count < 100) {
			badgeCanvas.addChild(badge);
			textField.x = (badge.width - textField.textWidth) / 2 - 3;
		}
		else if (minWidth <= badgeLeft.width + badgeRight.width) {
			badgeRight.x = badgeLeft.width;
			badgeCanvas.addChild(badgeLeft);
			badgeCanvas.addChild(badgeRight);
			textField.x = (badgeLeft.width + badgeRight.width - textField.textWidth) / 2 - 3;
		}
		else {
			var centerCount:int = Math.ceil((minWidth - badgeLeft.width - badgeRight.width) / badgeCenter.width);
			badgeCanvas.graphics.beginBitmapFill(centerBitmapData);
			badgeCanvas.graphics.drawRect(badgeLeft.width, 0, badgeCenter.width * centerCount, badgeCenter.height);
			badgeCanvas.graphics.endFill();
			badgeRight.x = badgeLeft.width + badgeCenter.width * centerCount;
			badgeCanvas.addChild(badgeLeft);
			badgeCanvas.addChild(badgeRight);
			textField.x = (badgeLeft.width + badgeCenter.width * centerCount + badgeRight.width - textField.textWidth) / 2 - 3;
		}
	}
	
	////////////////////////////////////////////////////////////
	//////////////イベントハンドラ
	////////////////////////////////////////////////////////////
	
	//______________ completeHandler ______________//
	private function completeHandler(e:Event):void {
		e.currentTarget.removeEventListener(Event.COMPLETE, completeHandler);
		if (badge.content && badgeLeft.content && badgeCenter.content && badgeRight.content) {
			centerBitmapData = new BitmapData(badgeCenter.width, badgeCenter.height);
			centerBitmapData.draw(badgeCenter);
			refreshCount();
		}
	}
	
}

import flash.display.DisplayObjectContainer;
import flash.display.Loader;
import flash.utils.ByteArray;
import mx.utils.Base64Decoder;
class Base64ImageLoader {
	static public function load(data:String):Loader {
		var byteArray:ByteArray;
		var base64Decoder:Base64Decoder = new Base64Decoder();
		base64Decoder.decode(data);
		try {
			byteArray = base64Decoder.toByteArray();
			byteArray.position = 0;
		}
		catch (e:Error) {
			return null;
		}
		var loader:Loader = new Loader();
		loader.loadBytes(byteArray);
		return loader;
	}
}