SHOW:
|
|
- or go back to the newest paste.
1 | - | package |
1 | + | package |
2 | - | { |
2 | + | { |
3 | - | import flash.display.Sprite; |
3 | + | import flash.display.Sprite; |
4 | - | import flash.display.StageAlign; |
4 | + | import flash.display.StageAlign; |
5 | - | import flash.display.StageOrientation; |
5 | + | import flash.display.StageOrientation; |
6 | - | import flash.display.StageScaleMode; |
6 | + | import flash.display.StageScaleMode; |
7 | - | import flash.events.Event; |
7 | + | import flash.events.Event; |
8 | - | import flash.events.StageOrientationEvent; |
8 | + | import flash.events.StageOrientationEvent; |
9 | - | |
9 | + | |
10 | - | import starling.core.Starling; |
10 | + | import starling.core.Starling; |
11 | - | import starling.display.Quad; |
11 | + | import starling.display.Quad; |
12 | - | |
12 | + | |
13 | - | public class mobileTest extends Sprite |
13 | + | public class mobileTest extends Sprite |
14 | - | { |
14 | + | { |
15 | - | private var myStarling:Starling; |
15 | + | private var myStarling:Starling; |
16 | - | public function mobileTest() |
16 | + | public function mobileTest() |
17 | - | { |
17 | + | { |
18 | - | super(); |
18 | + | super(); |
19 | - | stage.align = StageAlign.TOP_LEFT; |
19 | + | stage.align = StageAlign.TOP_LEFT; |
20 | - | stage.scaleMode = StageScaleMode.NO_SCALE; |
20 | + | stage.scaleMode = StageScaleMode.NO_SCALE; |
21 | - | stage.addEventListener(flash.events.Event.RESIZE,onResize); |
21 | + | stage.addEventListener(flash.events.Event.RESIZE,onResize); |
22 | - | } |
22 | + | } |
23 | - | |
23 | + | |
24 | - | private function onResize(e:flash.events.Event):void |
24 | + | private function onResize(e:flash.events.Event):void |
25 | - | { |
25 | + | { |
26 | - | |
26 | + | |
27 | - | if (myStarling == null) |
27 | + | if (myStarling == null) |
28 | - | { |
28 | + | { |
29 | - | Starling.handleLostContext = true; |
29 | + | Starling.handleLostContext = true; |
30 | - | myStarling = new Starling(Main,stage); |
30 | + | myStarling = new Starling(Main,stage); |
31 | - | myStarling.start(); |
31 | + | myStarling.start(); |
32 | - | } |
32 | + | } |
33 | - | } |
33 | + | } |
34 | } | |
35 | } | |
36 | ||
37 | - | package |
37 | + | package |
38 | - | { |
38 | + | { |
39 | - | import feathers.themes.AeonDesktopTheme; |
39 | + | import feathers.themes.AeonDesktopTheme; |
40 | - | |
40 | + | |
41 | - | import starling.core.Starling; |
41 | + | import starling.core.Starling; |
42 | - | import starling.display.Quad; |
42 | + | import starling.display.Quad; |
43 | - | import starling.display.Sprite; |
43 | + | import starling.display.Sprite; |
44 | - | import starling.events.Event; |
44 | + | import starling.events.Event; |
45 | - | |
45 | + | |
46 | - | public class Main extends Sprite |
46 | + | public class Main extends Sprite |
47 | - | { |
47 | + | { |
48 | - | private var theme:AeonDesktopTheme; |
48 | + | private var theme:AeonDesktopTheme; |
49 | - | public function Main() |
49 | + | public function Main() |
50 | - | { |
50 | + | { |
51 | - | super(); |
51 | + | super(); |
52 | - | this.addEventListener(starling.events.Event.ADDED_TO_STAGE,addToStage); |
52 | + | this.addEventListener(starling.events.Event.ADDED_TO_STAGE,addToStage); |
53 | - | } |
53 | + | } |
54 | - | private function addToStage(e:starling.events.Event):void |
54 | + | private function addToStage(e:starling.events.Event):void |
55 | - | { |
55 | + | { |
56 | - | this.theme = new AeonDesktopTheme( this.stage ); |
56 | + | this.theme = new AeonDesktopTheme( this.stage ); |
57 | - | var quad:Quad = new Quad(stage.stageHeight,stage.stageHeight,0xff0000); |
57 | + | var quad:Quad = new Quad(stage.stageHeight,stage.stageHeight,0xff0000); |
58 | - | addChild(quad); |
58 | + | addChild(quad); |
59 | - | |
59 | + | |
60 | - | } |
60 | + | } |
61 | } | |
62 | } | |
63 | ||
64 | - | var viewPort:Rectangle = new Rectangle(0, 0, stage.fullScreenWidth,stage.fullScreenHeight); |
64 | + | var viewPort:Rectangle = new Rectangle(0, 0, stage.fullScreenWidth,stage.fullScreenHeight); |
65 | Starling.current.viewPort = viewPort; | |
66 | ||
67 | - | Hi this is the code for StartUp file using starling. go through it and replace wtever u are missing. |
67 | + | Hi this is the code for StartUp file using starling. go through it and replace wtever u are missing. |
68 | - | |
68 | + | |
69 | - | package |
69 | + | package |
70 | - | { |
70 | + | { |
71 | - | import flash.display.Sprite; |
71 | + | import flash.display.Sprite; |
72 | - | import flash.display.StageAlign; |
72 | + | import flash.display.StageAlign; |
73 | - | import flash.display.StageScaleMode; |
73 | + | import flash.display.StageScaleMode; |
74 | - | import flash.events.Event; |
74 | + | import flash.events.Event; |
75 | - | import flash.geom.Rectangle; |
75 | + | import flash.geom.Rectangle; |
76 | - | import flash.system.Capabilities; |
76 | + | import flash.system.Capabilities; |
77 | - | |
77 | + | |
78 | - | import starling.core.Starling; |
78 | + | import starling.core.Starling; |
79 | - | import starling.events.TouchPhase; |
79 | + | import starling.events.TouchPhase; |
80 | - | |
80 | + | |
81 | - | //[SWF(width="2048", height="1536", frameRate="60", backgroundColor="0x000000")]//ipad 4th generation Retina |
81 | + | //[SWF(width="2048", height="1536", frameRate="60", backgroundColor="0x000000")]//ipad 4th generation Retina |
82 | - | //[SWF(width="1136", height="640", frameRate="60", backgroundColor="0x000000")]//iphone 5th generation |
82 | + | //[SWF(width="1136", height="640", frameRate="60", backgroundColor="0x000000")]//iphone 5th generation |
83 | - | //[SWF(width="1024", height="768", frameRate="60", backgroundColor="0x000000")]//ipad |
83 | + | //[SWF(width="1024", height="768", frameRate="60", backgroundColor="0x000000")]//ipad |
84 | - | //[SWF(width="960", height="640", frameRate="60", backgroundColor="0x000000")]//iphone 4th generation |
84 | + | //[SWF(width="960", height="640", frameRate="60", backgroundColor="0x000000")]//iphone 4th generation |
85 | - | [SWF(width="480", height="320", frameRate="60", backgroundColor="0x000000")] //iphone 3rd generation |
85 | + | [SWF(width="480", height="320", frameRate="60", backgroundColor="0x000000")] //iphone 3rd generation |
86 | - | |
86 | + | |
87 | - | public class SuperBaby extends Sprite |
87 | + | public class SuperBaby extends Sprite |
88 | - | { |
88 | + | { |
89 | - | private var mStarling:Starling; |
89 | + | private var mStarling:Starling; |
90 | - | |
90 | + | |
91 | - | public function SuperBaby() |
91 | + | public function SuperBaby() |
92 | - | { |
92 | + | { |
93 | - | // set general properties |
93 | + | // set general properties |
94 | - | |
94 | + | |
95 | - | stage.scaleMode = StageScaleMode.NO_SCALE; |
95 | + | stage.scaleMode = StageScaleMode.NO_SCALE; |
96 | - | stage.align = StageAlign.TOP_LEFT; |
96 | + | stage.align = StageAlign.TOP_LEFT; |
97 | - | |
97 | + | |
98 | - | Starling.multitouchEnabled = false; // useful on mobile devices |
98 | + | Starling.multitouchEnabled = false; // useful on mobile devices |
99 | - | Starling.handleLostContext = false; // not necessary on iOS. Saves a lot of memory! |
99 | + | Starling.handleLostContext = false; // not necessary on iOS. Saves a lot of memory! |
100 | - | |
100 | + | |
101 | - | // create a suitable viewport for the screen size |
101 | + | // create a suitable viewport for the screen size |
102 | - | var screenWidth:int = stage.stageWidth; |
102 | + | var screenWidth:int = stage.stageWidth; |
103 | - | var screenHeight:int = stage.stageHeight; |
103 | + | var screenHeight:int = stage.stageHeight; |
104 | - | var viewPort:Rectangle = new Rectangle(0, 0, screenWidth, screenHeight); |
104 | + | var viewPort:Rectangle = new Rectangle(0, 0, screenWidth, screenHeight); |
105 | - | var scaleFactor:uint; |
105 | + | var scaleFactor:uint; |
106 | - | if(screenHeight < 480){ |
106 | + | if(screenHeight < 480){ |
107 | - | scaleFactor = 1; |
107 | + | scaleFactor = 1; |
108 | - | }else if(screenHeight>=480){ //&& screenWidth<=640 |
108 | + | }else if(screenHeight>=480){ //&& screenWidth<=640 |
109 | - | scaleFactor = 2; |
109 | + | scaleFactor = 2; |
110 | - | } |
110 | + | } |
111 | - | |
111 | + | |
112 | - | // While Stage3D is initializing, the screen will be blank. To avoid any flickering, |
112 | + | // While Stage3D is initializing, the screen will be blank. To avoid any flickering, |
113 | - | // we display a startup image now and remove it below, when Starling is ready to go. |
113 | + | // we display a startup image now and remove it below, when Starling is ready to go. |
114 | - | |
114 | + | |
115 | - | // launch Starling |
115 | + | // launch Starling |
116 | - | mStarling = new Starling(Mainmenu, stage, viewPort); |
116 | + | mStarling = new Starling(Mainmenu, stage, viewPort); |
117 | - | mStarling.simulateMultitouch = false; |
117 | + | mStarling.simulateMultitouch = false; |
118 | - | mStarling.enableErrorChecking = false; |
118 | + | mStarling.enableErrorChecking = false; |
119 | - | |
119 | + | |
120 | - | |
120 | + | |
121 | - | Mainmenu.GAME_W=mStarling.stage.stageWidth = uint(screenWidth/scaleFactor); |
121 | + | Mainmenu.GAME_W=mStarling.stage.stageWidth = uint(screenWidth/scaleFactor); |
122 | - | Mainmenu.GAME_H=mStarling.stage.stageHeight = uint(screenHeight/scaleFactor); |
122 | + | Mainmenu.GAME_H=mStarling.stage.stageHeight = uint(screenHeight/scaleFactor); |
123 | - | |
123 | + | |
124 | - | mStarling.stage3D.addEventListener(Event.CONTEXT3D_CREATE, function(e:Event):void |
124 | + | mStarling.stage3D.addEventListener(Event.CONTEXT3D_CREATE, function(e:Event):void |
125 | - | { |
125 | + | { |
126 | - | mStarling.start(); |
126 | + | mStarling.start(); |
127 | - | }); |
127 | + | }); |
128 | - | |
128 | + | |
129 | - | |
129 | + | |
130 | - | |
130 | + | |
131 | - | |
131 | + | |
132 | - | // When the game becomes inactive, we pause Starling; otherwise, the enter frame event |
132 | + | // When the game becomes inactive, we pause Starling; otherwise, the enter frame event |
133 | - | // would report a very long 'passedTime' when the app is reactivated. |
133 | + | // would report a very long 'passedTime' when the app is reactivated. |
134 | - | } |
134 | + | } |
135 | - | } |
135 | + | } |
136 | } |