Package | com.chargedweb.swfsize |
Class | public class SWFSize |
Inheritance | SWFSize ![]() |
See also
Property | Defined By | ||
---|---|---|---|
bottomY : Number [read-only]
Returns the current bottomY coordinate i.e. | SWFSize | ||
leftX : Number [read-only]
Returns the current leftX coordinate i.e. | SWFSize | ||
rightX : Number [read-only]
Returns the current rightX coordinate i.e. | SWFSize | ||
scrollX : Number
{set/get} Scrolls the window to the X-axis to a specified value of pixels
| SWFSize | ||
scrollY : Number
{set/get} Scrolls the window to the Y-axis to a specified value of pixels
| SWFSize | ||
SWF_ID : String [static]
The swf attributes.id defined in the html code; you have to define this before calling other methods;
| SWFSize | ||
topY : Number [read-only]
Returns the current topY coordinate i.e. | SWFSize | ||
windowHeight : Number [read-only]
Returns the current available browser window height
| SWFSize | ||
windowWidth : Number [read-only]
Returns the current available browser window width
| SWFSize |
Method | Defined By | ||
---|---|---|---|
SWFSize(key:SWFSizeKey = null) | SWFSize | ||
autoSize(always:Boolean = false):void
Fits the swf's width and height values to browser available width and height
| SWFSize | ||
autoSizeHeight(always:Boolean = false):void
Fits the swf's height value to browser's available height
| SWFSize | ||
autoSizeWidth(always:Boolean = false):void
Fits the swf's width value to browser's available width
| SWFSize | ||
[static]
Singleton construction
| SWFSize | ||
getSWFHeight():Object
Returns the current height value of the swf container
| SWFSize | ||
getSWFWidth():Object
Returns the current width value of the swf container
| SWFSize | ||
setSWFHeight(value:Number, absolute:Boolean = true):void
Sets the height property of the swf container
| SWFSize | ||
setSWFWidth(value:Number, absolute:Boolean = true):void
Sets the width property of the swf container
| SWFSize |
bottomY | property |
bottomY:Number
[read-only] Returns the current bottomY coordinate i.e. equals to topY + windowHeight
public function get bottomY():Number
leftX | property |
leftX:Number
[read-only] Returns the current leftX coordinate i.e. the relative x '0' coordinate of the browser
public function get leftX():Number
rightX | property |
rightX:Number
[read-only] Returns the current rightX coordinate i.e. equals to leftX + windowWidth
public function get rightX():Number
scrollX | property |
scrollX:Number
{set/get} Scrolls the window to the X-axis to a specified value of pixels
public function get scrollX():Number
public function set scrollX(value:Number):void
scrollY | property |
scrollY:Number
{set/get} Scrolls the window to the Y-axis to a specified value of pixels
public function get scrollY():Number
public function set scrollY(value:Number):void
SWF_ID | property |
public static var SWF_ID:String
The swf attributes.id defined in the html code; you have to define this before calling other methods;
topY | property |
topY:Number
[read-only] Returns the current topY coordinate i.e. the relative y '0' coordinate of the browser
public function get topY():Number
windowHeight | property |
windowHeight:Number
[read-only] Returns the current available browser window height
public function get windowHeight():Number
windowWidth | property |
windowWidth:Number
[read-only] Returns the current available browser window width
public function get windowWidth():Number
SWFSize | () | Constructor |
public function SWFSize(key:SWFSizeKey = null)
Parameters
key:SWFSizeKey (default = null )
|
IllegalOperationError — The class cannot be instantiated.
|
autoSize | () | method |
public function autoSize(always:Boolean = false):void
Fits the swf's width and height values to browser available width and height
Parameters
always:Boolean (default = false ) — if set to true makes the swf's width and height properties elastic |
autoSizeHeight | () | method |
public function autoSizeHeight(always:Boolean = false):void
Fits the swf's height value to browser's available height
Parameters
always:Boolean (default = false ) — if set to true makes the swf's height property elastic |
autoSizeWidth | () | method |
public function autoSizeWidth(always:Boolean = false):void
Fits the swf's width value to browser's available width
Parameters
always:Boolean (default = false ) — if set to true makes the swf's width property elastic |
getInstance | () | method |
getSWFHeight | () | method |
public function getSWFHeight():Object
Returns the current height value of the swf container
ReturnsObject — Object { value:Number, absolute:Boolean };
|
getSWFWidth | () | method |
public function getSWFWidth():Object
Returns the current width value of the swf container
ReturnsObject — Object { value:Number, absolute:Boolean };
|
setSWFHeight | () | method |
public function setSWFHeight(value:Number, absolute:Boolean = true):void
Sets the height property of the swf container
Parameters
value:Number — new height value
| |
absolute:Boolean (default = true ) — whether the value is absolute or relative (%) |
setSWFWidth | () | method |
public function setSWFWidth(value:Number, absolute:Boolean = true):void
Sets the width property of the swf container
Parameters
value:Number — new width value
| |
absolute:Boolean (default = true ) — whether the value is absolute or relative (%) |
SWFSizeEvent.INIT
is dispatched
retrieves browser's window coordinates and metrics:
// import the SWFSize api import com.chargedweb.swfsize.SWFSize; import com.chargedweb.swfsize.SWFSizeEvent; // initialize SWFSize SWFSize.SWF_ID = stage.loaderInfo.parameters.swfsizeId; var swfSizer:SWFSize = SWFSize.getInstance(); swfSizer.addEventListener(SWFSizeEvent.INIT, onSWFSizeInit); function onSWFSizeInit(event:SWFSizeEvent):void { // your code logic goes here // eg: retrieve window coordinates and metrics on init trace(event.topY, event.bottomY, event.leftX, event.rightX); trace(swfSizer.windowWidth, swfSizer.windowHeight); }