forked from arpit/openpyro
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestStyleManager.as
More file actions
142 lines (105 loc) · 3.66 KB
/
TestStyleManager.as
File metadata and controls
142 lines (105 loc) · 3.66 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package
{
import org.openPyro.aurora.AuroraButtonSkin;
import org.openPyro.controls.Button;
import org.openPyro.controls.events.ButtonEvent;
import org.openPyro.core.ClassFactory;
import org.openPyro.core.UIContainer;
import org.openPyro.layout.VLayout;
import org.openPyro.managers.SkinManager;
import org.openPyro.painters.FillPainter;
import org.openPyro.painters.Stroke;
import org.openPyro.examples.SimpleButtonSkin;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.DropShadowFilter;
public class TestStyleManager extends Sprite{
private var button1:Button;
private var button2:Button;
public function TestStyleManager(){
stage.scaleMode = "noScale"
stage.align = "TL"
testButtonSkinning()
//basicTest();
}
private function testButtonSkinning():void
{
var buttonStyleFactory:ClassFactory = new ClassFactory(AuroraButtonSkin);
buttonStyleFactory.properties = {cornerRadius:10,
percentUnusedWidth:100,
percentUnusedHeight:100}
SkinManager.getInstance().registerSkin(buttonStyleFactory, "Button")
var button:Button = new Button()
button.width = 150
button.height = 25;
addChild(button)
button.addEventListener(ButtonEvent.DOWN, onButtonDown);
button.x = button.y = 100;
button2 = new Button()
button2.width = 150
button2.height = 25;
addChild(button2);
button2.addEventListener(ButtonEvent.DOWN, onButton2Down);
button2.y = 100
button2.x = 300;
}
private function onButton2Down(event:ButtonEvent):void
{
button2.styleName = "coolButtonStyle";
SkinManager.getInstance().loadSkinSwf("Skin.swf");
}
private function onButtonDown(event:Event):void
{
var buttonStyleFactory:ClassFactory = new ClassFactory(AuroraButtonSkin);
buttonStyleFactory.properties = {cornerRadius:20,
upColors:[0x750811, 0xff0000],
overColors:[0xff0000,0x750811],
downColors:[0x750811, 0x750811],
percentUnusedWidth:100,
percentUnusedHeight:100}
SkinManager.getInstance().registerSkin(buttonStyleFactory, "Button")
}
private function basicTest():void{
var container:UIContainer = new UIContainer()
addChild(container);
var vLayout:VLayout = new VLayout(60);
container.layout = vLayout;
container.x = container.y = 100;
var stroke:Stroke = new Stroke()
stroke.thickness = 2;
stroke.color = 0xff0000;
var fillPainter:FillPainter = new FillPainter(0xcccccc,.4,stroke);
container.backgroundPainter = (fillPainter);
container.width = 100
container.height = 300
button1 = new Button()
button1.addEventListener(Event.RESIZE, onResize);
container.addChild(button1);
button1.percentUnusedWidth = 100
button1.percentUnusedHeight = 50;
button2 = new Button()
button2.addEventListener(Event.RESIZE, onResize);
container.addChild(button2);
button2.percentUnusedWidth = 100
button2.percentUnusedHeight = 50;
var skin:SimpleButtonSkin = new SimpleButtonSkin();
button1.skin = skin;
var skinManager:SkinManager = new SkinManager()
skinManager.addEventListener(SkinManager.SKIN_SWF_LOADED, onSkinSwfLoaded);
skinManager.registerSkinClient(button2, "SimpleFlaButtonSkin")
skinManager.loadSkinSwf('Skin.swf');
}
private function onSkinSwfLoaded(event:Event):void{
trace('swf loaded ')
}
private function onResize(event:Event):void{
}
public function onStageClick(event:MouseEvent):void{
/*trace('stage click');
var skin:SimpleButtonSkin = new SimpleButtonSkin();
button.skin = skin;
*/
}
}
}