Package | starlingbuilder.engine.util |
Class | public class StageUtil |
Inheritance | StageUtil Object |
Example usage:
var stageUtil:StageUtil = new StageUtil(stage); var size:Point = stageUtil.getScaledStageSize(); var starling:Starling = new Starling(Game, stage, new Rectangle(0, 0, stageUtil.stageWidth, stageUtil.stageHeight)); starling.stage.stageWidth = size.x; starling.stage.stageHeight = size.y;
See also
Property | Defined By | ||
---|---|---|---|
stageHeight : int [read-only]
Return stage height of the device
| StageUtil | ||
stageWidth : int [read-only]
Return stage width of the device
| StageUtil |
Method | Defined By | ||
---|---|---|---|
StageUtil(stage:Stage, designStageWidth:int = 640, designStageHeight:int = 960)
Constructor
| StageUtil | ||
fitBackground(object:DisplayObject):void [static]
Fit background to the center of the Starling stage. | StageUtil | ||
fitNativeBackground(object:DisplayObject, stage:Stage):void [static]
Fit background to the center of the native stage, If the aspect ratio is different, some cropping may happen. | StageUtil | ||
getScaledStageSize(stageWidth:int = 0, stageHeight:int = 0):Point
Calculate the scaled starling stage size
| StageUtil |
stageHeight | property |
stageHeight:int
[read-only] Return stage height of the device
public function get stageHeight():int
stageWidth | property |
stageWidth:int
[read-only] Return stage width of the device
public function get stageWidth():int
StageUtil | () | Constructor |
public function StageUtil(stage:Stage, designStageWidth:int = 640, designStageHeight:int = 960)
Constructor
Parametersstage:Stage — flash stage
| |
designStageWidth:int (default = 640 ) — design stage width of the project
| |
designStageHeight:int (default = 960 ) — design stage height of the project
|
fitBackground | () | method |
public static function fitBackground(object:DisplayObject):void
Fit background to the center of the Starling stage. If the aspect ratio is different, some cropping may happen.
Parameters
object:DisplayObject — background display object
|
fitNativeBackground | () | method |
public static function fitNativeBackground(object:DisplayObject, stage:Stage):void
Fit background to the center of the native stage, If the aspect ratio is different, some cropping may happen.
Parameters
object:DisplayObject — background display object
| |
stage:Stage — native stage
|
getScaledStageSize | () | method |
public function getScaledStageSize(stageWidth:int = 0, stageHeight:int = 0):Point
Calculate the scaled starling stage size
Parameters
stageWidth:int (default = 0 ) — stageWidth of flash stage, if not specified then use this.stageWidth
| |
stageHeight:int (default = 0 ) — stageHeight of flash stage, if not specified then use this.stageHeight
|
Point — the scaled starling stage
|