~extremepopcorn/dhlib/dhlib_ep

« back to all changes in this revision

Viewing changes to lib/ui/test/ScrollbarTest.mhx

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* <license>
 
2
 * This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
 
3
 * For full copyright and license information please refer to doc/license.txt.
 
4
 * </license> 
 
5
 */
 
6
package ui.test;
 
7
 
 
8
import ui.Scrollbar;
 
9
import ui.UIEvent;
 
10
import ui.StaticText;
 
11
import flash.events.Event;
 
12
 
 
13
class ScrollbarTest extends ui.StageLayout
 
14
{
 
15
        var vertScroll : Scrollbar;
 
16
        var horzScroll : Scrollbar;
 
17
        var scrollText : StaticText;
 
18
        
 
19
        public function new()
 
20
        {
 
21
                super();
 
22
                var me = this;
 
23
                
 
24
                vertScroll = Scrollbar.vertical();
 
25
                vertScroll.setRange( 0, 100, 10 );
 
26
                vertScroll.addEventListener( UIEvent.USER_CHANGE, 
 
27
                        function( evt : Event ) { me.scrollText.text += "\nVERT:" + me.vertScroll.at; } );
 
28
                addChild( vertScroll );
 
29
                
 
30
                horzScroll = Scrollbar.horizontal();
 
31
                horzScroll.setRange( -50, 25, 5 );
 
32
                horzScroll.addEventListener( UIEvent.USER_CHANGE, 
 
33
                        function( evt : Event ) { me.scrollText.text += "\nHORZ:" + me.horzScroll.at; } );
 
34
                addChild( horzScroll );
 
35
                
 
36
                scrollText = StaticText.scrollText( "Scroll other bars to add text.", null, mathx.MatPoint.at( 30, 15 ) );
 
37
                addChild( scrollText );
 
38
        }
 
39
        
 
40
        override function _resize( w : Float, h : Float )
 
41
        {
 
42
                vertScroll.move( w/10, h/10 );
 
43
                vertScroll.resize( w/20, 8*h/10 );
 
44
                
 
45
                horzScroll.move( 2*w/10, h/10 );
 
46
                horzScroll.resize( 7*w/10, h/20 );
 
47
                
 
48
                scrollText.move( w/3, h/3 );
 
49
                scrollText.resize( 2*w/3, 2*h/3 );
 
50
        }
 
51
        
 
52
        public static function main()
 
53
        {
 
54
                ui.StageLayout.setup( ScrollbarTest );
 
55
        }
 
56
}
 
 
b'\\ No newline at end of file'