forked from arpit/openpyro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestViewStack.as
More file actions
79 lines (65 loc) · 1.96 KB
/
TestViewStack.as
File metadata and controls
79 lines (65 loc) · 1.96 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package
{
import org.openPyro.aurora.AuroraContainerSkin;
import org.openPyro.containers.SlidePane;
import org.openPyro.core.UIContainer;
import org.openPyro.painters.FillPainter;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class TestViewStack extends Sprite
{
public function TestViewStack()
{
super();
stage.scaleMode = "noScale";
stage.align = "TL";
testViewStack();
}
private var viewStack:SlidePane = new SlidePane();
private var magenta:UIContainer = new UIContainer()
private var cyan:UIContainer = new UIContainer()
private var yellow:UIContainer = new UIContainer()
private function testViewStack():void
{
viewStack.transitionAttitude = 1;
viewStack.width = 400;
viewStack.height = stage.stageHeight-300;
viewStack.x = viewStack.y = 10;
viewStack.skin = new AuroraContainerSkin()
viewStack.backgroundPainter = new FillPainter(0xcccccc);
addChild(viewStack);
cyan.backgroundPainter = new FillPainter(0x00ffff);
cyan.width = 150;
cyan.height = 300;
cyan.name = "cyan";
viewStack.addChild(cyan);
yellow.backgroundPainter = new FillPainter(0xffff00);
yellow.width = 225;
yellow.height = 350;
yellow.name = "yellow";
viewStack.addChild(yellow);
magenta.backgroundPainter = new FillPainter(0xff00ff);
magenta.width = 300;
magenta.height = 400;
magenta.name = "magenta";
viewStack.addChild(magenta);
stage.addEventListener(MouseEvent.CLICK, onStageClick);
stage.addEventListener(Event.RESIZE, function(event:Event):void{
viewStack.height = stage.stageHeight-300;
});
}
private function onStageClick(event:MouseEvent):void
{
/*
if(viewStack.selectedChild == magenta){
viewStack.selectedChild = cyan
}
else
{
viewStack.selectedChild = magenta;
}*/
viewStack.selectedIndex = ((viewStack.selectedIndex +1) % 3);
}
}
}