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