チェンジセット 2440
- コミット日時:
- 2009/04/10 12:08:14 (3 年前)
- ファイル:
-
- as3/Eseclock/branches/alumican/samples/01/MyEseclock01.swf (更新) (変更前)
- as3/Eseclock/branches/alumican/samples/02/MyEseclock02.swf (更新) (変更前)
- as3/Eseclock/branches/alumican/samples/03/MyEseclock03.swf (更新) (変更前)
- as3/Eseclock/branches/alumican/samples/04/MyEseclock04.swf (更新) (変更前)
- as3/Eseclock/branches/alumican/samples/05/MyEseclock05.swf (更新) (変更前)
- as3/Eseclock/branches/alumican/samples/99/CustomClockField.as (更新) (4 diffs)
- as3/Eseclock/branches/alumican/samples/99/CustomDescriptionField.as (更新) (3 diffs)
- as3/Eseclock/branches/alumican/samples/99/MyEseclock.swf (更新) (変更前)
- as3/Eseclock/branches/alumican/src/jp (追加)
- as3/Eseclock/branches/alumican/src/jp/nium (追加)
- as3/Eseclock/branches/alumican/src/jp/nium/core (追加)
- as3/Eseclock/branches/alumican/src/jp/nium/core/display (追加)
- as3/Eseclock/branches/alumican/src/jp/nium/core/display/IDisplayObject.as (追加)
- as3/Eseclock/branches/alumican/src/org/libspark/eseclock/Eseclock.as (更新) (2 diffs)
- as3/Eseclock/branches/alumican/src/org/libspark/eseclock/object/ClockSprite.as (更新) (10 diffs)
- as3/Eseclock/branches/alumican/src/org/libspark/eseclock/textfield/EseclockDefaultClockTextField.as (追加)
- as3/Eseclock/branches/alumican/src/org/libspark/eseclock/textfield/EseclockDefaultDescriptionTextField.as (追加)
- as3/Eseclock/branches/alumican/src/org/libspark/eseclock/textfield/EseclockDefaultTextField.as (削除)
- as3/Eseclock/branches/alumican/src/org/libspark/eseclock/textfield/IEseclockTextField.as (更新) (4 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/Eseclock/branches/alumican/samples/99/CustomClockField.as
r2439 r2440 56 56 //------------------------------------- 57 57 58 public function get defaultTextFormat():TextFormat { return hours.defaultTextFormat; } 59 public function set defaultTextFormat(value:TextFormat):void { hours.defaultTextFormat = minutes.defaultTextFormat = seconds.defaultTextFormat = value; } 60 61 public function get autoSize():String { return hours.autoSize; } 62 public function set autoSize(value:String):void { hours.autoSize = minutes.autoSize = seconds.autoSize = value; } 63 64 public function get selectable():Boolean { return hours.selectable; } 65 public function set selectable(value:Boolean):void { hours.selectable = minutes.selectable = seconds.selectable = value; } 66 67 public function get description():String { return ""; } 68 public function set description(value:String):void { } 69 70 public function get textWidth():Number { return seconds.x + seconds.textWidth; } 71 public function get textHeight():Number { return hours.textHeight; } 58 public function get objectWidth():Number { return seconds.x + seconds.textWidth; } 59 public function get objectHeight():Number { return hours.textHeight; } 72 60 73 61 … … 82 70 * コンストラクタ 83 71 */ 84 public function CustomClockField():void { 72 public function CustomClockField():void 73 { 85 74 var fmt:TextFormat = hours.defaultTextFormat; 86 75 fmt.letterSpacing = -3; 87 88 76 hours.defaultTextFormat = fmt; 89 77 minutes.defaultTextFormat = fmt; … … 99 87 //------------------------------------- 100 88 101 public function update(h:uint, m:uint, s:uint):void { 89 /** 90 * 色を設定する関数 91 * @param h 時 92 * @param m 分 93 * @param s 秒 94 */ 95 public function setColor(color:uint):void 96 { 97 var fmt:TextFormat = hours.defaultTextFormat; 98 fmt.color = color; 99 hours.defaultTextFormat = fmt; 100 minutes.defaultTextFormat = fmt; 101 seconds.defaultTextFormat = fmt; 102 } 103 104 /** 105 * 時計表示を更新する関数 106 * @param h 時 107 * @param m 分 108 * @param s 秒 109 */ 110 public function updateClock(h:uint, m:uint, s:uint):void 111 { 102 112 hours.text = Eseclock.toDigitString(h); 103 113 minutes.text = Eseclock.toDigitString(m); … … 105 115 } 106 116 107 public function setTextFormat(textFormat:TextFormat, beginIndex:int = -1, endIndex:int = -1):void { 108 hours.setTextFormat(textFormat, beginIndex, endIndex); 109 minutes.setTextFormat(textFormat, beginIndex, endIndex); 110 seconds.setTextFormat(textFormat, beginIndex, endIndex); 117 /** 118 * テキストを更新する関数 119 * @param message 表示文字列 120 */ 121 public function updateDescription(message:String):void 122 { 111 123 } 112 124 as3/Eseclock/branches/alumican/samples/99/CustomDescriptionField.as
r2439 r2440 2 2 import flash.text.TextField; 3 3 import flash.text.TextFormat; 4 import org.libspark.eseclock.textfield.EseclockDefault TextField;4 import org.libspark.eseclock.textfield.EseclockDefaultDescriptionTextField; 5 5 6 6 /** … … 12 12 */ 13 13 14 public class CustomDescriptionField extends EseclockDefault TextField {14 public class CustomDescriptionField extends EseclockDefaultDescriptionTextField { 15 15 16 16 //------------------------------------- … … 79 79 //------------------------------------- 80 80 81 override public function set description(value:String):void { 82 super.description = value; 83 } 81 84 82 85 83 as3/Eseclock/branches/alumican/src/org/libspark/eseclock/Eseclock.as
r2430 r2440 153 153 //-------------------------------------------------------------------------- 154 154 155 public function get description():String { return _ clock1.description; }155 public function get description():String { return _description; } 156 156 public function set description(value:String):void 157 157 { 158 _description = value; 158 159 _clock1.updateDescription(value); 159 160 _clock2.updateDescription(value); 160 161 } 162 163 private var _description:String = "TOKYO / JAPAN"; 161 164 162 165 … … 473 476 _clock1.updateField(date.hours, date.minutes, date.seconds); 474 477 _clock2.updateField(date.hours, date.minutes, date.seconds); 478 479 //最初に表示するテキスト 480 _clock1.updateDescription(_description); 481 _clock2.updateDescription(_description); 475 482 476 483 //自動開始 as3/Eseclock/branches/alumican/src/org/libspark/eseclock/object/ClockSprite.as
r2430 r2440 35 35 import flash.text.TextFormat; 36 36 import flash.utils.getDefinitionByName; 37 import org.libspark.eseclock.textfield.EseclockDefaultTextField; 37 38 import org.libspark.eseclock.textfield.EseclockDefaultClockTextField; 39 import org.libspark.eseclock.textfield.EseclockDefaultDescriptionTextField; 38 40 import org.libspark.eseclock.textfield.IEseclockTextField; 39 41 … … 62 64 private var _leading:Number; 63 65 66 //テキストが空文字列以外の場合はtrue 67 private var _hasDescription:Boolean; 68 69 64 70 65 71 … … 69 75 //------------------------------------- 70 76 71 //時計の下に表示するテキスト72 public function get description():String { return _sub.description; }73 public function set description(value:String):void { updateDescription(value); }74 75 77 //テキスト色 76 public function get textColor():uint { return _field.defaultTextFormat.color as uint; }77 78 public function set textColor(value:uint):void { 78 79 _changeTextColor(_field, value); … … 81 82 82 83 //背景色 83 public function get backgroundColor():uint { return _backgroundColor; }84 84 public function set backgroundColor(value:uint):void { _drawBackground(value); } 85 85 … … 128 128 private function _createFields(color:uint, clockAsset:String = "", subAsset:String = ""):void 129 129 { 130 var fmt:TextFormat; 131 132 fmt = (clockAsset == "") ? new TextFormat("Arial Black", 96, color, true) : new TextFormat(null, null, color); 133 _field = _createField(clockAsset, fmt); 134 _field.update(99, 99, 99); 135 136 fmt = (subAsset == "") ? new TextFormat("Arial Black", 36, color, true) : new TextFormat(null, null, color); 137 _sub = _createField(subAsset, fmt); 138 description = "TOKYO / JAPAN"; 130 _field = _createField(clockAsset, EseclockDefaultClockTextField); 131 _field.setColor(color); 132 _field.updateClock(99, 99, 99); 133 134 _masked.addChild(_field as DisplayObject); 135 136 137 _sub = _createField(subAsset, EseclockDefaultDescriptionTextField); 138 _sub.setColor(color); 139 _sub.updateDescription("TOKYO / JAPAN"); 140 141 _masked.addChild(_sub as DisplayObject); 142 139 143 140 144 //中央揃え … … 144 148 /** 145 149 * 各テキストフィールドを生成する関数 146 * @param tf147 150 * @param asset 148 * @param fmt149 */ 150 private function _createField(asset:String, fmt:TextFormat):IEseclockTextField {151 * @param defaultClass 152 */ 153 private function _createField(asset:String, defaultClass:Class):IEseclockTextField { 151 154 var tf:IEseclockTextField; 152 155 153 156 if (asset == "") { 154 tf = new EseclockDefaultTextField();157 tf = new defaultClass() as IEseclockTextField; 155 158 } else { 156 159 var fieldClass:Class = getDefinitionByName(asset) as Class; … … 158 161 } 159 162 160 tf.defaultTextFormat = fmt;161 tf.selectable = false;162 tf.autoSize = TextFieldAutoSize.LEFT;163 _masked.addChild(tf as DisplayObject);164 165 163 return tf; 166 164 } … … 172 170 public function updateDescription(description:String):void 173 171 { 174 _sub.description = description; 172 _hasDescription = (description != "") ? true : false; 173 174 _sub.updateDescription(description); 175 175 176 176 //中央揃え … … 186 186 public function updateField(h:uint, m:uint, s:uint):void 187 187 { 188 _field.update (h, m, s);188 _field.updateClock(h, m, s); 189 189 } 190 190 191 191 /** 192 192 * テキストフィールドの色を変更する関数 193 * @param t extFieldターゲット193 * @param tf ターゲット 194 194 * @param color 色 195 195 */ 196 private function _changeTextColor(textField:IEseclockTextField, color:uint):void 197 { 198 var fmt:TextFormat = textField.defaultTextFormat; 199 fmt.color = color; 200 textField.defaultTextFormat = fmt; 201 textField.setTextFormat(fmt); 196 private function _changeTextColor(tf:IEseclockTextField, color:uint):void 197 { 198 tf.setColor(color); 202 199 } 203 200 … … 212 209 213 210 //テキストフィールドの中央揃え 214 var margin:int = ( description.length > 0) ? _leading : 0;215 var totalHeight:uint = _field. textHeight + _sub.textHeight;216 217 _field.x = (_w - _field. textWidth) / 2;218 _field.y = (_h - totalHeight ) / 2;219 220 _sub.x = (_w - _sub. textWidth) / 2;221 _sub.y = (_h - totalHeight ) / 2 + _field.textHeight + margin;211 var margin:int = (_hasDescription) ? _leading : 0; 212 var totalHeight:uint = _field.objectHeight + _sub.objectHeight; 213 214 _field.x = (_w - _field.objectWidth) / 2; 215 _field.y = (_h - totalHeight ) / 2; 216 217 _sub.x = (_w - _sub.objectWidth) / 2; 218 _sub.y = (_h - totalHeight ) / 2 + _field.objectHeight + margin; 222 219 } 223 220 } as3/Eseclock/branches/alumican/src/org/libspark/eseclock/textfield/IEseclockTextField.as
r2428 r2440 27 27 { 28 28 import flash.text.TextFormat; 29 import jp.nium.core.display.IDisplayObject; 29 30 30 31 /** … … 37 38 */ 38 39 39 public interface IEseclockTextField 40 public interface IEseclockTextField extends IDisplayObject 40 41 { 41 42 … … 76 77 //------------------------------------- 77 78 78 function get x():Number; 79 function set x(value:Number):void; 80 81 function get y():Number; 82 function set y(value:Number):void; 83 84 function get defaultTextFormat():TextFormat; 85 function set defaultTextFormat(value:TextFormat):void; 86 87 function get autoSize():String; 88 function set autoSize(value:String):void; 89 90 function get selectable():Boolean; 91 function set selectable(value:Boolean):void; 92 93 function get description():String; 94 function set description(value:String):void; 95 96 function get textWidth():Number; 97 function get textHeight():Number; 79 /** 80 * 表示オブジェクトの幅と高さを取得する 81 */ 82 function get objectWidth():Number; 83 function get objectHeight():Number; 98 84 99 85 … … 114 100 115 101 /** 116 * 時計の文字盤を更新する関数(時計のTextField用) 102 * 色を設定する関数 103 * @param color 104 */ 105 function setColor(color:uint):void; 106 107 /** 108 * 時計表示を更新する関数 117 109 * @param h 時 118 110 * @param m 分 119 111 * @param s 秒 120 112 */ 121 function update (h:uint, m:uint, s:uint):void;113 function updateClock(h:uint, m:uint, s:uint):void; 122 114 123 115 /** 124 * TextFormatを適用する関数 125 * @param textFormat 126 * @param beginIndex 127 * @param endIndex 116 * テキストを更新する関数 117 * @param message 表示文字列 128 118 */ 129 function setTextFormat(textFormat:TextFormat, beginIndex:int = -1, endIndex:int = -1):void; 130 119 function updateDescription(message:String):void; 131 120 132 121

