root/as3/Eseclock/branches/alumican/src/org/libspark/eseclock/object/ContentSprite.as

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

--

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.object
27 {
28         import caurina.transitions.Tweener;
29         import flash.display.DisplayObject;
30         import flash.display.Graphics;
31         import flash.display.Shape;
32         import flash.display.Sprite;
33         import flash.text.TextField;
34         import flash.text.TextFieldAutoSize;
35         import flash.text.TextFormat;
36         import flash.utils.getDefinitionByName;
37        
38         /**
39          * ContentSprite.as
40          * 時計の合間に表示するコンテンツ
41          *
42          * @author      alumican.net<Yukiya Okuda>
43          * @link        http://alumican.net/
44          * @link        http://www.libspark.org/
45          */
46        
47         public class ContentSprite extends TweenMaskSprite
48         {
49                 //-------------------------------------
50                 // VARIABLES
51                 //-------------------------------------
52                
53                 //コンテンツ
54                 private var _content:DisplayObject;
55                
56                
57                
58                
59                
60                 //-------------------------------------
61                 // GETTER/SETTER
62                 //-------------------------------------
63                
64                 //コンテンツ
65                 public function get content():DisplayObject { return _content; }
66                
67                
68                
69                
70                
71                 //-------------------------------------
72                 // CONSTRUCTOR
73                 //-------------------------------------
74                
75                 /**
76                  * コンストラクタ
77                  * @param       w       幅
78                  * @param       h       高さ
79                  */
80                 public function ContentSprite(w:Number, h:Number)
81                 {
82                         //背景はベタ塗りで真っ白
83                         super(w, h, 0xffffff);
84                        
85                         //背景を非表示にしておく
86                         _background.visible = false;
87                 }
88                
89                
90                
91                
92                
93                 //-------------------------------------
94                 // METHODS
95                 //-------------------------------------
96                
97                 /**
98                  * コンテンツをステージに配置関数
99                  * @param       content コンテンツ
100                  */
101                 public function addContent(content:DisplayObject):void
102                 {
103                         removeContent();
104                        
105                         _content = content;
106                         _masked.addChild(_content);
107                        
108                         _background.visible = true;
109                 }
110                
111                 /**
112                  * コンテンツをステージから削除する関数
113                  */
114                 public function removeContent():void
115                 {
116                         if (_content == null) return;
117                        
118                         _masked.removeChild(_content);
119                         _content = null;
120                        
121                         _background.visible = false;
122                 }
123         }
124 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。