This repository has been archived by the owner on Jul 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFeathersWeather.as
65 lines (56 loc) · 1.91 KB
/
FeathersWeather.as
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
package
{
import feathers.examples.weather.Main;
import feathers.utils.ScreenDensityScaleFactorManager;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageOrientation;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.geom.Rectangle;
import flash.system.Capabilities;
import flash.utils.ByteArray;
import starling.core.Starling;
[SWF(width="960",height="640",frameRate="60",backgroundColor="#4d545e")]
public class FeathersWeather extends Sprite
{
public function FeathersWeather()
{
if(this.stage)
{
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
}
this.mouseEnabled = this.mouseChildren = false;
this.loaderInfo.addEventListener(Event.COMPLETE, loaderInfo_completeHandler);
}
private var _starling:Starling;
private var _scaler:ScreenDensityScaleFactorManager;
private function loaderInfo_completeHandler(event:Event):void
{
Starling.multitouchEnabled = true;
this._starling = new Starling(Main, this.stage);
this._starling.enableErrorChecking = false;
this._starling.supportHighResolutions = true;
//this._starling.showStats = true;
//this._starling.showStatsAt(HAlign.LEFT, VAlign.BOTTOM);
this._scaler = new ScreenDensityScaleFactorManager(this._starling);
this._starling.start();
this.stage.addEventListener(Event.DEACTIVATE, stage_deactivateHandler, false, 0, true);
}
private function stage_deactivateHandler(event:Event):void
{
this._starling.stop();
this.stage.addEventListener(Event.ACTIVATE, stage_activateHandler, false, 0, true);
}
private function stage_activateHandler(event:Event):void
{
this.stage.removeEventListener(Event.ACTIVATE, stage_activateHandler);
this._starling.start();
}
}
}