1
8
9 import com.sekati.core.App;
10 import com.sekati.ui.Scroll;
11 import com.sekati.utils.Delegate;
12 import com.sekati.display.CoreClip;
13
16 class com.project.ui.ContentBox extends CoreClip {
17 public var _mask:MovieClip;
18 public var _content:MovieClip;
19 public var _scrollbar:MovieClip;
20 public var _tracker:MovieClip;
21 public var _scroll:Object;
22 public var _btn0:MovieClip;
23 public var _btn1:MovieClip;
24 public var _btn2:MovieClip;
25 public var _acBtn:MovieClip;
26 public var _slideBtn:MovieClip;
27
28 private function ContentBox() {
29 }
30 public function configUI():Void {
31 _mask = _this.mask;
32 _content = _this.contents;
33 _tracker = _this.contents;
34 _scrollbar = _this.scrollbar;
35 _btn0 = _this.btn0;
36 _btn1 = _this.btn1;
37 _btn2 = _this.btn2;
38 _acBtn = _this.acBtn;
39 _slideBtn = _this.slideBtn;
40
41 App.bc.subscribe( _this );
42 _content.tf.autoSize = true;
43 _content.tf.html = true;
44
45 _content._y = 0;
46
47 _btn0.tf.text = "page 1";
48 _btn1.tf.text = "page 2";
49 _btn2.tf.text = "page 3";
50 _acBtn.tf.text = "addTxt";
51 _slideBtn.tf.text = "slide";
52 _btn0.onRelease = Delegate.create( _this, btn0_onRelease );
53 _btn1.onRelease = Delegate.create( _this, btn1_onRelease );
54 _btn2.onRelease = Delegate.create( _this, btn2_onRelease );
55 _acBtn.onRelease = Delegate.create( _this, acBtn_onRelease );
56 _slideBtn.onRelease = Delegate.create( _this, slideBtn_onRelease );
57 }
58 private function onAppConfigured():Void {
59 App.log.trace( this, "* initializing ContentBox" );
60 _content.tf.htmlText = App.db.data.copy_1.data;
61 _this.initScroller( );
62 }
63 private function initScroller():Void {
64
65 _scroll = new Scroll( "_y", _content, _mask, _scrollbar.gutter, _scrollbar.bar, true, true, true, true, _tracker, .8, .5, {up:0xFFFFFF, over:0xFFCC00} );
66 }
67 private function resetScroller():Void {
68 _scroll = null;
69 _scrollbar.bar._y = 0;
70 _content._y = 0;
71 initScroller( );
72 }
73 public function setContent(copy:String):Void {
74 _content.tf.htmlText = copy;
75 resetScroller( );
76 }
77 private function btn0_onRelease():Void {
78 setContent( App.db.data.copy_1.data );
79 }
80 private function btn1_onRelease():Void {
81 setContent( App.db.data.copy_2.data );
82 }
83 private function btn2_onRelease():Void {
84 setContent( App.db.data.copy_3.data );
85 }
86 private function acBtn_onRelease():Void {
87 _content.tf.htmlText += App.db.data.copy_1.data + "\n\n---------------------------------------\n\n" + _content.tf.htmlText + "\n\n-----------------------------------------\n\nEOF";
88 }
89 private function slideBtn_onRelease():Void {
90 _scroll.slideContent( 500 );
91 }
92 }