Packagecom.presenttechnologies.phunegaming.client.platform.service
Classpublic class UtilService
InheritanceUtilService Inheritance Object

Class helper



Public Methods
 MethodDefined By
  
arrayEncode(array:Array):String
[static] Stringify a AS3 array to a json String.
UtilService
  
flashDisplayToStarlingDisplay(displayFlash:DisplayObject, textureName:String, width:Number = -1, height:Number = -1):Image
[static] Converts an flash.display.DisplayObject to a starling.display.Image.
UtilService
  
getTexture(textureName:String, width:int, height:int):Texture
[static] Get texture created on flashDisplayToStarlingDisplay method.
UtilService
  
jsonDecode(data:String, clazz:Class):*
[static] Convert a json string object to a AS3 class.
UtilService
  
scaleUnit(value:int, stage:Stage = null):int
[static] Scale values in int values.
UtilService
  
scaleUnitToNumber(value:Number):Number
[static] Scale values in Number values.
UtilService
Method Detail
arrayEncode()method
public static function arrayEncode(array:Array):String

Stringify a AS3 array to a json String.

Parameters

array:Array — The array to be encoded.

Returns
String — The json String.
flashDisplayToStarlingDisplay()method 
public static function flashDisplayToStarlingDisplay(displayFlash:DisplayObject, textureName:String, width:Number = -1, height:Number = -1):Image

Converts an flash.display.DisplayObject to a starling.display.Image.

Parameters

displayFlash:DisplayObject — The original flash display object.
 
textureName:String — The texture name used. Used to create cache in starling display.
 
width:Number (default = -1) — The width of the returning image.
 
height:Number (default = -1) — The height of the returning image.

Returns
Image — The starling image.
getTexture()method 
public static function getTexture(textureName:String, width:int, height:int):Texture

Get texture created on flashDisplayToStarlingDisplay method.

Parameters

textureName:String — Texture name
 
width:int — Texture width
 
height:int — Texture height

Returns
Texture — Texture
jsonDecode()method 
public static function jsonDecode(data:String, clazz:Class):*

Convert a json string object to a AS3 class. If the json object is an array the result will be an AS3 array with the objects passes as Clazz.

Parameters

data:String — The json data
 
clazz:Class — The AS3 class definition

Returns
* — The AS3 object instance.
scaleUnit()method 
public static function scaleUnit(value:int, stage:Stage = null):int

Scale values in int values.

Parameters

value:int — The original size (int)
 
stage:Stage (default = null) — The stage

Returns
int — The scaled int value
scaleUnitToNumber()method 
public static function scaleUnitToNumber(value:Number):Number

Scale values in Number values.

Parameters

value:Number — The original size (Number)

Returns
Number — The scaled Number value