Packageardisia.components.htmlFrame
Classpublic class HtmlFrame
InheritanceHtmlFrame Inheritance spark.components.supportClasses.SkinnableComponent
Subclasses HtmlDragDrop

Component that displays a html frame inside a Flex component. Multiple instances can be created in a single Flex application.

This component will NOT work within the AIR environment. For HTML support in AIR, try the native mx.controls.HTML and flash.html.HTMLLoader classes.

View the technical documentation on the Ardisia Labs website for more information.

TO DOs

NOTES



Public Properties
 PropertyDefined By
  frameId : String
[read-only] The html DOM id of the frame.
HtmlFrame
  framePaddingBottom : Number
Padding used to inset the frame.
HtmlFrame
  framePaddingLeft : Number
Padding used to inset the frame.
HtmlFrame
  framePaddingRight : Number
Padding used to inset the frame.
HtmlFrame
  framePaddingTop : Number
Padding used to inset the frame.
HtmlFrame
  sourceURL : String
[read-only] Return the value of the "src" property on the frame, if any.
HtmlFrame
  visible : Boolean
[override] Sets the visibility of the component for both the underlying Group and the html frame.
HtmlFrame
Protected Properties
 PropertyDefined By
  _borderThickness : Number = 1
HtmlFrame
  _borderVisible : Boolean = true
HtmlFrame
  CHECK_TEST_ID_CALLBACK : String = checkTestIdCallback
HtmlFrame
  ONLOAD_CALLBACK : String = onloadCallback
HtmlFrame
  RESIZE_CALLBACK : String = resizeCallback
HtmlFrame
  stylesDirty : Boolean
HtmlFrame
Public Methods
 MethodDefined By
  
HtmlFrame
  
callFrameFunction(functionName:String, params:Array = null):*
Call the named function on the frame.
HtmlFrame
  
dispose():void
Completely remove the frame and flex container.
HtmlFrame
  
printFrame():void
Print the frame.
HtmlFrame
  
setFrameRawHTML(markup:String):void
Set the raw html markup for the html frame to the passed string.
HtmlFrame
  
setFrameSourceURL(url:String):void
Set the "src" property on the html frame.
HtmlFrame
  
setStyleProperty(propertyName:String, value:String):void
Set a style property on the frame.
HtmlFrame
Protected Methods
 MethodDefined By
  
Add the functions that the browser can call via javascript.
HtmlFrame
  
Sets up and calls javascript code to store a reference to the embedded swf on the browser window object.
HtmlFrame
  
Call all the queued functions and reset the queue.
HtmlFrame
  
Create the html frame.
HtmlFrame
  
eventHandler(event:Event):void
Handles events for the class.
HtmlFrame
  
frameHandler(frameId:String):void
[static] Called by javascript code after a html frame fires the 'onload' event.
HtmlFrame
  
isTestId(testString:String):Boolean
Called by the browser in javascript.
HtmlFrame
  
Layout the frame.
HtmlFrame
  
Remove the iframe.
HtmlFrame
  
[static] Called by javascript code after the html frame window fires its 'resize' event.
HtmlFrame
Events
 Event Summary Defined By
  Dispatched when the "onload" event is dispatched by the html frame.HtmlFrame
Styles
 Style Description Defined By
  
backgroundAlpha
Type: Number CSS Inheritance: no
The alpha of the background. The default value is 1.
HtmlFrame
  
backgroundColor
Type: uint Format: Color CSS Inheritance: no
The color of the background. Does not apply to the iframe, only flash regions exposed by padding. The default value is #FFFFFF.
HtmlFrame
  
borderAlpha
Type: Number CSS Inheritance: no
The alpha of the border. The default value is 1.
HtmlFrame
  
borderColor
Type: uint Format: Color CSS Inheritance: no
The color of the border. The default value is #000000.
HtmlFrame
  
borderThickness
Type: Number CSS Inheritance: no
The thickness of the border. The default value is 1.
HtmlFrame
  
borderVisible
Type: Boolean CSS Inheritance: no
Whether to display a border. The default value is true.
HtmlFrame
Skin States

To skin the component, implement a skin that defines the following states. Although you must implement all skin states, a skin state can be empty. An empty skin state specifies no changes to the default skin state.


 Skin State Description Defined By
  
disabled
HtmlFrame
  
loading
State after the start of loading content into the html frame, but before the "onload" event fires on the html iframe. HtmlFrame
  
normal
HtmlFrame
Property Detail
_borderThicknessproperty
protected var _borderThickness:Number = 1

_borderVisibleproperty 
protected var _borderVisible:Boolean = true

CHECK_TEST_ID_CALLBACKproperty 
protected var CHECK_TEST_ID_CALLBACK:String = checkTestIdCallback

frameIdproperty 
frameId:String  [read-only]

The html DOM id of the frame.

The default value is "".


Implementation
    public function get frameId():String
framePaddingBottomproperty 
framePaddingBottom:Number

Padding used to inset the frame.

The default value is 0.


Implementation
    public function get framePaddingBottom():Number
    public function set framePaddingBottom(value:Number):void
framePaddingLeftproperty 
framePaddingLeft:Number

Padding used to inset the frame.

The default value is 0.


Implementation
    public function get framePaddingLeft():Number
    public function set framePaddingLeft(value:Number):void
framePaddingRightproperty 
framePaddingRight:Number

Padding used to inset the frame.

The default value is 0.


Implementation
    public function get framePaddingRight():Number
    public function set framePaddingRight(value:Number):void
framePaddingTopproperty 
framePaddingTop:Number

Padding used to inset the frame.

The default value is 0.


Implementation
    public function get framePaddingTop():Number
    public function set framePaddingTop(value:Number):void
ONLOAD_CALLBACKproperty 
protected var ONLOAD_CALLBACK:String = onloadCallback

RESIZE_CALLBACKproperty 
protected var RESIZE_CALLBACK:String = resizeCallback

sourceURLproperty 
sourceURL:String  [read-only]

Return the value of the "src" property on the frame, if any.

The default value is "".


Implementation
    public function get sourceURL():String
stylesDirtyproperty 
protected var stylesDirty:Boolean

visibleproperty 
visible:Boolean[override]

Sets the visibility of the component for both the underlying Group and the html frame.

The default value is true.


Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
Constructor Detail
HtmlFrame()Constructor
public function HtmlFrame()



Method Detail
addActionscriptCallbacks()method
protected function addActionscriptCallbacks():void

Add the functions that the browser can call via javascript.

addEmbeddedReference()method 
protected function addEmbeddedReference():void

Sets up and calls javascript code to store a reference to the embedded swf on the browser window object.

Uses the swf reference to offset the iframe layout by the swf's offset from the upper-left corner (see the javascript layout code).

Also, the javascript code uses the reference to call actionscript callbacks on the "load" and "resize" window events.

callFrameFunction()method 
public function callFrameFunction(functionName:String, params:Array = null):*

Call the named function on the frame.

It is important to note that only functions defined on the window frame can be called via this method. If you need to access a function on a different object, create a function on the window object to access the deeper function.

Parameters

functionName:String — the name of the function to call
 
params:Array (default = null) — an Array of parameters to pass to the function call

Returns
* — the data returned by the javascript call
callQueuedFunctions()method 
protected function callQueuedFunctions():void

Call all the queued functions and reset the queue.

createFrame()method 
protected function createFrame():void

Create the html frame.

dispose()method 
public function dispose():void

Completely remove the frame and flex container.

eventHandler()method 
protected function eventHandler(event:Event):void

Handles events for the class.

Parameters

event:Event — the Event that triggered the handler

frameHandler()method 
protected static function frameHandler(frameId:String):void

Called by javascript code after a html frame fires the 'onload' event.

Must be a class function because each HtmlFrame sets up a callback to the same named function in actionscript. As a result, if multiple HtmlFrame components are added, the latter callback will overwrite the earlier callback and as a result, the earlier frame will never be initialized.

The class handler will use the passed frameId param to determine which HtmlFrame instance fired the onload event.

Will set the frame visibility to 'visible', and call any queued functions.

Parameters

frameId:String — the frameId of the frame that fired the handler

isTestId()method 
protected function isTestId(testString:String):Boolean

Called by the browser in javascript. Tests whether the passed string is the test string.

Parameters

testString:String — the string to test against

Returns
Boolean — true on success
layoutFrame()method 
protected function layoutFrame():void

Layout the frame. Account for the borderStroke and framePadding.

printFrame()method 
public function printFrame():void

Print the frame. Note: this may fail for external URL's due to security limitations.

removeIframe()method 
protected function removeIframe():void

Remove the iframe.

resizeHandler()method 
protected static function resizeHandler():void

Called by javascript code after the html frame window fires its 'resize' event.

Must be a class function because the window resize event will fire only once, so it needs to be applied to all instances after the unitary event is dispatched.

setFrameRawHTML()method 
public function setFrameRawHTML(markup:String):void

Set the raw html markup for the html frame to the passed string. Will overwrite any existent markup.

Will not work if the frame has previously had its "src" property set. In other words, once a url is applied, this call no longer works.

Parameters

markup:String — the html to insert into the frame

setFrameSourceURL()method 
public function setFrameSourceURL(url:String):void

Set the "src" property on the html frame.

Parameters

url:String — the string url

setStyleProperty()method 
public function setStyleProperty(propertyName:String, value:String):void

Set a style property on the frame.

Parameters

propertyName:String — the property to change
 
value:String — the property value represented as a String

Event Detail
frameOnload Event
Event Object Type: ardisia.components.htmlFrame.events.HtmlFrameEvent
HtmlFrameEvent.type property = ardisia.components.htmlFrame.events.HtmlFrameEvent

Dispatched when the "onload" event is dispatched by the html frame.