root/as3/Eseclock/branches/alumican/src/org/libspark/eseclock/textfield/EseclockDefaultDescriptionTextField.as

リビジョン 2440, 3.9 kB (コミッタ: alumican, コミット時期: 3 年 前)

Eseclock:IEseclockTextFieldの仕様を変更

Line 
1 /**
2  * Licensed under the MIT License
3  *
4  * Copyright (c) 2008 BeInteractive! (www.be-interactive.org) and
5  *               2009 alumican.net (www.alumican.net) and
6  *               Spark project (www.libspark.org)
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  */
26 package org.libspark.eseclock.textfield
27 {
28         import flash.display.Sprite;
29         import flash.text.TextField;
30         import flash.text.TextFieldAutoSize;
31         import flash.text.TextFormat;
32        
33         import org.libspark.eseclock.Eseclock;
34        
35         /**
36          * EseclockDefaultTextField.as
37          * デフォルトで表示するテキスト
38          *
39          * @author      alumican.net<Yukiya Okuda>
40          * @link        http://alumican.net/
41          * @link        http://www.libspark.org/
42          */
43        
44         public class EseclockDefaultDescriptionTextField extends Sprite implements IEseclockTextField
45         {
46                
47                 //-------------------------------------
48                 // CLASS CONSTANTS
49                 //-------------------------------------
50                
51                
52                
53                
54                
55                 //-------------------------------------
56                 // VARIABLES
57                 //-------------------------------------
58                
59                 protected var _field:TextField;
60                
61                
62                
63                
64                
65                 //-------------------------------------
66                 // GETTER/SETTER
67                 //-------------------------------------
68                
69                
70                
71                
72                
73                 //-------------------------------------
74                 // STAGE INSTANCES
75                 //-------------------------------------
76                
77                
78                
79                
80                
81                 //-------------------------------------
82                 // GETTER/SETTER
83                 //-------------------------------------
84                
85                 public function get objectWidth():Number { return _field.textWidth; }
86                 public function get objectHeight():Number { return _field.textHeight; }
87                
88                
89                
90                
91                
92                 //-------------------------------------
93                 // CONSTRUCTOR
94                 //-------------------------------------
95                
96                 /**
97                  * コンストラクタ
98                  */
99                 public function EseclockDefaultDescriptionTextField()
100                 {
101                         _field = new TextField();
102                        
103                         _field.defaultTextFormat = new TextFormat("Arial Black", 36, null, true);
104                         _field.selectable = false;
105                         _field.autoSize = TextFieldAutoSize.LEFT;
106                        
107                         addChild(_field);
108                 }
109                
110                
111                
112                
113                
114                 //-------------------------------------
115                 // METHODS
116                 //-------------------------------------
117                
118                 /**
119                  * 色を設定する関数
120                  * @param       h       時
121                  * @param       m       分
122                  * @param       s       秒
123                  */
124                 public function setColor(color:uint):void
125                 {
126                         var fmt:TextFormat = _field.defaultTextFormat;
127                         fmt.color = color;
128                         _field.defaultTextFormat = fmt;
129                 }
130                
131                 /**
132                  * 時計表示を更新する関数
133                  * @param       h       時
134                  * @param       m       分
135                  * @param       s       秒
136                  */
137                 public function updateClock(h:uint, m:uint, s:uint):void
138                 {
139                 }
140                
141                 /**
142                  * テキストを更新する関数
143                  * @param       message 表示文字列
144                  */
145                 public function updateDescription(message:String):void
146                 {
147                         _field.text = message;
148                 }
149                
150                
151                
152                
153                
154                 //-------------------------------------
155                 // EVENT HANDLER
156                 //-------------------------------------
157         }
158 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。