public
Description: Github flash badge
Homepage: http://spinach.andascarygoat.com/tags/badjo
Clone URL: git://github.com/zmack/badjo.git
Search Repo:
Scrolling, detail text is now multiline
zmack (author)
Sun May 04 08:53:55 -0700 2008
commit  74d19885efaac6594492e3a96899075be008da81
tree    7433cbc2e23c5ac74a1880b291e5926aaf808706
parent  684dbc312be55e83d39966db83a793be04bbf1e0
...
128
129
130
131
 
132
133
 
134
135
136
...
128
129
130
 
131
132
133
134
135
136
137
0
@@ -128,9 +128,10 @@
0
     private function createTextField(text:String):TextField {
0
       var textField:TextField = new TextField();
0
       
0
- textField.width = 200;
0
+ textField.width = stage.stageWidth - 20; // FIXME: dirty hardcode business.
0
       textField.height = 0;
0
       textField.autoSize = TextFieldAutoSize.LEFT;
0
+ textField.wordWrap = true;
0
       textField.styleSheet = this.createStyleSheet();
0
       textField.selectable = false;
0
       textField.htmlText = '<p>' + text + '</p>';
...
2
3
4
 
 
5
6
7
...
16
17
18
 
19
20
21
22
...
27
28
29
 
30
31
32
33
 
34
35
36
37
38
39
...
102
103
104
 
 
 
 
 
 
 
 
 
105
106
107
108
109
110
 
111
112
113
114
115
116
117
118
 
 
 
119
120
121
122
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
125
126
...
2
3
4
5
6
7
8
9
...
18
19
20
21
22
23
24
25
...
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
 
124
125
126
127
128
129
130
 
 
131
132
133
134
 
 
 
 
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
0
@@ -2,6 +2,8 @@
0
   import flash.display.Sprite;
0
   import flash.text.TextField;
0
   import flash.text.StyleSheet;
0
+ import flash.events.Event;
0
+ import flash.events.MouseEvent;
0
   
0
   public class ProjectList extends Sprite {
0
     public const AVATAR_SIZE:uint = 40;
0
@@ -16,6 +18,7 @@
0
     private var _headerText:TextField;
0
     private var _mask:Sprite;
0
     private var _container:Sprite;
0
+ private var _controls:Sprite;
0
     private var _buttonSpacing:uint;
0
     private var _maximum_y:uint;
0
 
0
0
@@ -27,10 +30,12 @@
0
       this.backgroundColor = 0x00FFD0;
0
       this._items = new Array();
0
 
0
+ this._controls = this.createScroll();
0
       this._mask = this.createMask();
0
       this._container = new Sprite();
0
       addChild(this._mask);
0
       addChild(this._container);
0
+ addChild(this._controls);
0
       this._container.mask = this._mask;
0
     }
0
     
0
0
0
0
@@ -102,25 +107,89 @@
0
       return text;
0
     }
0
 
0
+ private function createMask():Sprite {
0
+ var mask:Sprite = new Sprite;
0
+
0
+ mask.graphics.clear();
0
+ mask.graphics.beginFill(0x000000);
0
+ mask.graphics.drawRoundRect(this.lateralPadding, this.getHeaderHeight() + this.bottomPadding, this.getMaskWidth(), this.getMaskHeight(), 15, 15);
0
+ return mask;
0
+ }
0
+
0
     private function getHeaderHeight():uint {
0
       return AVATAR_SIZE + this.bottomPadding;
0
     }
0
 
0
     private function getMaskHeight():uint {
0
- return this.listHeight - AVATAR_SIZE - 2 * this.bottomPadding;
0
+ return this.listHeight - AVATAR_SIZE - 3 * this.bottomPadding - this._controls.height;
0
     }
0
 
0
     private function getMaskWidth():uint {
0
       return this.listWidth - 2 * this.lateralPadding;
0
     }
0
 
0
- private function createMask():Sprite {
0
- var mask:Sprite = new Sprite;
0
+ private function scrollUp(e:Event):void {
0
+ this._container.y -= 5;
0
+ }
0
 
0
- mask.graphics.clear();
0
- mask.graphics.beginFill(0x000000);
0
- mask.graphics.drawRoundRect(this.lateralPadding, this.getHeaderHeight(), this.getMaskWidth(), this.getMaskHeight(), 15, 15);
0
- return mask;
0
+ private function scrollDown(e:Event):void {
0
+ this._container.y += 5;
0
+ }
0
+
0
+ private function createScroll():Sprite {
0
+ var scrollControls:Sprite = new Sprite;
0
+
0
+ var scrollUp:Sprite = this.createScrollUp();
0
+ var scrollDown:Sprite = this.createScrollDown();
0
+
0
+ scrollControls.addChild(scrollUp);
0
+ scrollControls.addChild(scrollDown);
0
+ scrollUp.x = 30;
0
+ scrollDown.x = 60;
0
+
0
+ scrollControls.y = this.listHeight - scrollControls.height;
0
+
0
+ return scrollControls;
0
+ }
0
+
0
+ private function createScrollUp():Sprite {
0
+ var s:Sprite = this.createButtonyThing();
0
+
0
+ s.addEventListener(MouseEvent.MOUSE_DOWN, this.startScrollUp);
0
+ return s;
0
+ }
0
+
0
+ private function createScrollDown():Sprite {
0
+ var s:Sprite = this.createButtonyThing();
0
+
0
+ s.addEventListener(MouseEvent.MOUSE_DOWN, this.startScrollDown);
0
+ return s;
0
+ }
0
+
0
+ private function startScrollUp(e:Event):void {
0
+ stage.addEventListener(MouseEvent.MOUSE_UP, this.stopScroll);
0
+ this.addEventListener(Event.ENTER_FRAME, this.scrollUp);
0
+ }
0
+
0
+ private function startScrollDown(e:Event):void {
0
+ stage.addEventListener(MouseEvent.MOUSE_UP, this.stopScroll);
0
+ this.addEventListener(Event.ENTER_FRAME, this.scrollDown);
0
+ }
0
+
0
+ private function stopScroll(e:Event):void {
0
+ this.removeEventListener(Event.ENTER_FRAME, this.scrollUp);
0
+ this.removeEventListener(Event.ENTER_FRAME, this.scrollDown);
0
+ stage.removeEventListener(MouseEvent.MOUSE_UP, this.stopScroll);
0
+ }
0
+
0
+ private function createButtonyThing():Sprite {
0
+ var s:Sprite = new Sprite();
0
+
0
+ s.graphics.clear();
0
+ s.graphics.beginFill(0xFFFFFF);
0
+ s.graphics.drawRoundRect(0, 0, 15, 15, 15, 15);
0
+
0
+ return s;
0
     }
0
   }
0
 }

Comments

    No one has commented yet.