Adobe Flex 2 Language Reference - collected by Jimbob | Back to MY RESOURCES


Packageflash.html
Classpublic class HTMLControl
InheritanceHTMLControl Inheritance Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object

The HTMLControl object is a type of display object that is a container for HTML content.

View the examples.



Public Properties
 PropertyDefined by
 InheritedaccessibilityProperties : AccessibilityProperties
The current accessibility options for this display object.
DisplayObject
 Inheritedalpha : Number
Indicates the alpha transparency value of the object specified.
DisplayObject
 InheritedblendMode : String
A value from the BlendMode class that specifies which blend mode to use.
DisplayObject
 InheritedbuttonMode : Boolean
Specifies the button mode of this sprite.
Sprite
 InheritedcacheAsBitmap : Boolean
If set to true, Flash Player caches an internal bitmap representation of the display object.
DisplayObject
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcontextMenu : ContextMenu
Specifies the context menu associated with this object.
InteractiveObject
 InheriteddoubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events.
InteractiveObject
 InheriteddropTarget : DisplayObject
Specifies the display object over which the sprite is being dragged, or on which the sprite was dropped.
Sprite
  exposeRuntime : Boolean
Determines if ActionScript definitions should be made available to JavaScript running in the HTMLControl.
HTMLControl
 Inheritedfilters : Array
An indexed array that contains each filter object currently associated with the display object.
DisplayObject
 InheritedfocusRect : Object
Specifies whether this object displays a focus rectangle.
InteractiveObject
 Inheritedgraphics : Graphics
Specifies the Graphics object that belongs to this sprite where vector drawing commands can occur.
Sprite
  height : Number
Specifies the height of the rectangle of the HTML canvas that is being rendered.
HTMLControl
 InheritedhitArea : Sprite
Designates another sprite to serve as the hit area for a sprite.
Sprite
  htmlHeight : Number
[read-only] The height, in pixels, of the HTML content.
HTMLControl
  htmlWidth : Number
[read-only] The width, in pixels, of the HTML content.
HTMLControl
  loaded : Boolean
[read-only] Indicates whether the JavaScript load event corresponding to the previous call to the load or loadString method has been delivered to the HTML DOM in the HTMLControl.
HTMLControl
 InheritedloaderInfo : LoaderInfo
Returns a LoaderInfo object containing information about loading the file to which this display object belongs.
DisplayObject
  location : String
[read-only] The URL for the content loaded in the HTMLControl object.
HTMLControl
 Inheritedmask : DisplayObject
The calling display object is masked by the specified mask object.
DisplayObject
 InheritedmouseChildren : Boolean
Determines whether or not the children of the object are mouse enabled.
DisplayObjectContainer
 InheritedmouseEnabled : Boolean
Specifies whether this object receives mouse messages.
InteractiveObject
 InheritedmouseX : Number
Indicates the x coordinate of the mouse position, in pixels.
DisplayObject
 InheritedmouseY : Number
Indicates the y coordinate of the mouse position, in pixels.
DisplayObject
 Inheritedname : String
Indicates the instance name of the DisplayObject.
DisplayObject
 InheritednumChildren : int
Returns the number of children of this object.
DisplayObjectContainer
 InheritedopaqueBackground : Object
Specifies whether the display object is opaque with a certain background color.
DisplayObject
 Inheritedparent : DisplayObjectContainer
Indicates the DisplayObjectContainer object that contains this display object.
DisplayObject
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedroot : DisplayObject
For a display object in a loaded SWF file, the root property is the top-most display object in the portion of the display list's tree structure represented by that SWF file.
DisplayObject
 Inheritedrotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation.
DisplayObject
 Inheritedscale9Grid : Rectangle
The current scaling grid that is in effect.
DisplayObject
 InheritedscaleX : Number
Indicates the horizontal scale (percentage) of the object as applied from the registration point.
DisplayObject
 InheritedscaleY : Number
Indicates the vertical scale (percentage) of an object as applied from the registration point of the object.
DisplayObject
  scrollH : Number
The horizonal scroll position of the HTML content within the HTMLControl object.
HTMLControl
 InheritedscrollRect : Rectangle
The scroll rectangle bounds of the display object.
DisplayObject
  scrollV : Number
The vertical scroll position of the HTML content within the HTMLControl object.
HTMLControl
 InheritedsoundTransform : SoundTransform
Controls sound within this sprite.
Sprite
 Inheritedstage : Stage
The Stage of the display object.
DisplayObject
 InheritedtabChildren : Boolean
Determines whether the children of the object are tab enabled.
DisplayObjectContainer
 InheritedtabEnabled : Boolean
Specifies whether this object is in the tab order.
InteractiveObject
 InheritedtabIndex : int
Specifies the tab ordering of objects in a SWF file.
InteractiveObject
 InheritedtextSnapshot : TextSnapshot
Returns a TextSnapshot object for this DisplayObjectContainer instance.
DisplayObjectContainer
 Inheritedtransform : Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds.
DisplayObject
 InheriteduseHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the mouse rolls over a sprite in which the buttonMode property is set to true.
Sprite
 Inheritedvisible : Boolean
Whether or not the display object is visible.
DisplayObject
  width : Number
Specifies the width of the rectangle of the HTML canvas that is being rendered.
HTMLControl
  window : JavaScriptObject
[read-only] The global JavaScript object for the content loaded into the HTML control.
HTMLControl
 Inheritedx : Number
Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer.
DisplayObject
 Inheritedy : Number
Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer.
DisplayObject
Public Methods
 MethodDefined by
  
Creates an HTMLControl object.
HTMLControl
 Inherited
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Indicates whether the security restrictions would cause any display objects to be omitted from the list returned by calling the DisplayObjectContainer.getObjectsUnderPoint() method with the specified point point.
DisplayObjectContainer
  
cancelLoad():void
Cancels any load operation in progress.
HTMLControl
 Inherited
Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself.
DisplayObjectContainer
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.
DisplayObject
 Inherited
Returns the child display object instance that exists at the specified index.
DisplayObjectContainer
 Inherited
Returns the child display object that exists with the specified name.
DisplayObjectContainer
 Inherited
Returns the index position of a child DisplayObject instance.
DisplayObjectContainer
 Inherited
Returns an array of objects that lie under the specified point and are children (or grandchildren, and so on) of this DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
Returns a rectangle that defines the boundary of the display object, based on the coordinate system defined by the targetCoordinateSpace parameter, excluding any strokes on shapes.
DisplayObject
 Inherited
Converts the point object from the Stage (global) coordinates to the display object's (local) coordinates.
DisplayObject
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Evaluates the display object to see if it overlaps or intersects with the obj display object.
DisplayObject
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
Evaluates the display object to see if it overlaps or intersects with the point specified by the x and y parameters.
DisplayObject
  
load(urlRequestToLoad:URLRequest):void
Load the control with data from the site specified by urlRequest.
HTMLControl
  
loadString(htmlContent:String):void
Load the control with the HTML content contained in the HTML string.
HTMLControl
 Inherited
Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates.
DisplayObject
  
reload():void
Reloads the page from the current location.
HTMLControl
 Inherited
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance.
DisplayObjectContainer
 Inherited
Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer.
DisplayObjectContainer
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
setChildIndex(child:DisplayObject, index:int):void
Changes the position of an existing child in the display object container.
DisplayObjectContainer
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
Lets the user drag the specified sprite.
Sprite
 Inherited
stopDrag():void
Ends the startDrag() method.
Sprite
 Inherited
Swaps the z-order (front-to-back order) of the two specified child objects.
DisplayObjectContainer
 Inherited
swapChildrenAt(index1:int, index2:int):void
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list.
DisplayObjectContainer
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 EventSummaryDefined by
 Inherited Dispatched when Flash Player gains operating system focus and becomes active.EventDispatcher
 Inherited Dispatched when a display object is added to the display list.DisplayObject
 Inherited Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained.DisplayObject
 Inherited Dispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject.InteractiveObject
   Signals that the last load operation requested by loadString or load has completed.HTMLControl
 Inherited Dispatched when Flash Player loses operating system focus and is becoming inactive.EventDispatcher
   Signals that the HTML DOM has be created in response to a load operation.HTMLControl
 Inherited Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same InteractiveObject when that object's doubleClickEnabled flag is set to true.InteractiveObject
 Inherited Dispatched when the playhead is entering a new frame.DisplayObject
 Inherited Dispatched after a display object gains focus.InteractiveObject
 Inherited Dispatched after a display object loses focus.InteractiveObject
   Signals the one or both of the htmlWidth and htmlHeight properties have changed.HTMLControl
   Signals that the rendering of content in the HTMLControl object is fully up-to-date.HTMLControl
 Inherited Dispatched when the user presses a key.InteractiveObject
 Inherited Dispatched when the user attempts to change focus by using keyboard navigation.InteractiveObject
 Inherited Dispatched when the user releases a key.InteractiveObject
   Signals the location property of the HTMLControl object has changed.HTMLControl
 Inherited Dispatched when a user presses the pointing device button over an InteractiveObject instance in the Flash Player window.InteractiveObject
 Inherited Dispatched when the user attempts to change focus by using a pointer device.InteractiveObject
 Inherited Dispatched when a user moves the pointing device while it is over an InteractiveObject.InteractiveObject
 Inherited Dispatched when the user moves a pointing device away from an InteractiveObject instance.InteractiveObject
 Inherited Dispatched when the user moves a pointing device over an InteractiveObject instance in the Flash Player window.InteractiveObject
 Inherited Dispatched when a user releases the pointing device button over an InteractiveObject instance in the Flash Player window.InteractiveObject
 Inherited Dispatched when a mouse wheel is spun over an InteractiveObject instance in the Flash Player window.InteractiveObject
 Inherited Dispatched when a display object is about to be removed from the display list.DisplayObject
 Inherited Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained.DisplayObject
 Inherited Dispatched when the display list is about to be updated and rendered.DisplayObject
 Inherited Dispatched when the user moves a pointing device away from an InteractiveObject instance.InteractiveObject
 Inherited Dispatched when the user moves a pointing device over an InteractiveObject instance.InteractiveObject
   Signals that the scrollH or scrollV property have been changed by the HTMLControl.HTMLControl
 Inherited Dispatched when the value of the object's tabChildren flag changes.InteractiveObject
 Inherited Dispatched when the object's tabEnabled flag changes.InteractiveObject
 Inherited Dispatched when the value of the object's tabIndex property changes.InteractiveObject
   Signals that an uncaught JavaScript exception occurred in the HTMLControl.HTMLControl
Property detail
exposeRuntimeproperty
exposeRuntime:Boolean  [read-write]

Determines if ActionScript definitions should be made available to JavaScript running in the HTMLControl. Defaults to false. Setting this property has no effect until after the next documentCreated event has been dispatched.

Implementation
    public function get exposeRuntime():Boolean
    public function set exposeRuntime(value:Boolean):void
heightproperty 
height:Number  [read-write]

Specifies the height of the rectangle of the HTML canvas that is being rendered. This is the height of the HTMLControl DisplayObject in pixels. Changing this property will cause the HTMLControl to re-render the HTML document. HTML_BOUNDS_CHANGE events may dispatched in response to changing this property. When you set the width and height property of an HTMLControl object, the bounds of the object change but content is not scaled (as would happen with other types of display objects).

Implementation
    public function get height():Number
    public function set height(value:Number):void
htmlHeightproperty 
htmlHeight:Number  [read-only]

The height, in pixels, of the HTML content.

Implementation
    public function get htmlHeight():Number
htmlWidthproperty 
htmlWidth:Number  [read-only]

The width, in pixels, of the HTML content.

Implementation
    public function get htmlWidth():Number
loadedproperty 
loaded:Boolean  [read-only]

Indicates whether the JavaScript load event corresponding to the previous call to the load or loadString method has been delivered to the HTML DOM in the HTMLControl. This property will be true before the COMPLETE event is dispatched. It is possible that this property will never become true. This happens in the same cases as when the COMPLETE event is never dispatched.

Implementation
    public function get loaded():Boolean
locationproperty 
location:String  [read-only]

The URL for the content loaded in the HTMLControl object.

Implementation
    public function get location():String
scrollHproperty 
scrollH:Number  [read-write]

The horizonal scroll position of the HTML content within the HTMLControl object.

Implementation
    public function get scrollH():Number
    public function set scrollH(value:Number):void
scrollVproperty 
scrollV:Number  [read-write]

The vertical scroll position of the HTML content within the HTMLControl object.

Implementation
    public function get scrollV():Number
    public function set scrollV(value:Number):void
widthproperty 
width:Number  [read-write]

Specifies the width of the rectangle of the HTML canvas that is being rendered. This is the width of the HTMLControl DisplayObject in pixels. Changing this property will cause the HTMLControl to re-render the HTML document. HTML_BOUNDS_CHANGE events may dispatched in response to changing this property. When you set the width and height property of an HTMLControl object, the bounds of the object change but content is not scaled (as would happen with other types of display objects).

Implementation
    public function get width():Number
    public function set width(value:Number):void
windowproperty 
window:JavaScriptObject  [read-only]

The global JavaScript object for the content loaded into the HTML control.

Implementation
    public function get window():JavaScriptObject
Constructor detail
HTMLControl()constructor
public function HTMLControl()

Creates an HTMLControl object.

Method detail
cancelLoad()method
public function cancelLoad():void

Cancels any load operation in progress.

load()method 
public function load(urlRequestToLoad:URLRequest):void

Load the control with data from the site specified by urlRequest. Sets the loaded property to false. This method initiates an operation that always completes asynchronously. It is possible the COMPLETE event will never delivered. This will happen if any of the HTML content loaded into the HTMLControl never finishes downloaded. The most likely scenario is the HTML content references a URL to a CGI script that generates content forever. A call to this method implicitly cancels any pending previous load operation initiated with this method or the loadString method. The COMPLETE event for the previous load operation will never be delivered.

Parameters
urlRequestToLoad:URLRequest — The URLRequest object containing information about the URL to load. In addition to the URL to load, a URLRequest object contains properties that define the HTTP form submission method (GET or POST), any data to be transmitted with the request, and request headers.

See also

loadString()method 
public function loadString(htmlContent:String):void

Load the control with the HTML content contained in the HTML string. When rendering of the of the html in the string is complete, the COMPLETE event is dispatched. The COMPLETE event is always dispatched asynchronously. A call to this method implicitly cancels any pending previous load operation initiated with this method or the load method. The COMPLETE event for the previous load operation will never be delivered. If the HTML specified in the string has no references to external resources, then this method will synchronously render the HTML. However, the COMPLETE event will still be dispatched asynchronously. If the loaded property of this class is true immediately following a call to this function then the HTML content specified in htmlContent argument was rendered synchronously. It is possible the COMPLETE event will never delivered. This will happen if any of the HTML content loaded into the HTMLControl never finishes downloaded. The most likely scenario is the HTML content references a URL to a CGI script that generates content forever.

Parameters
htmlContent:String — The string containing the HTML content to load into the HTMLControl object.
reload()method 
public function reload():void

Reloads the page from the current location.

Event detail
completeevent 
Event object type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Signals that the last load operation requested by loadString or load has completed. The event is dispatched AFTER the javascript load event has fired on the HTML DOM in the HTMLControl. Always dispatched asynchronously. The event handler for this event may call any method or access any property of the HTMLControl.

Defines the value of the type property of a complete event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe network object that has completed loading.

See also

domInitializeevent  
Event object type: flash.events.Event

Signals that the HTML DOM has be created in response to a load operation. The load() and loadString() methods of the HTMLControl object throw an exception while this event is being dispatched. Any property or method of any JavaScript object accessible from the window property of the HTMLControl object that controls the URL that is loaded in the HTMLControl object throws an exception if set or called while this event is dispatched. For example, setting window.location via the window property of the HTMLControl object will result in a JavaScript exception.

See also

htmlBoundsChangeevent  
Event object type: flash.events.Event

Signals the one or both of the htmlWidth and htmlHeight properties have changed. This may be result from a new image or other content loading, for example. Event handlers may call any method or access any property of the HTMLControl object.

The HTMLControl object may dispatch this event any time after a load operation is initiated. The HTMLControl object may dispatch this event even after the object has dispatched the complete event.

See also

htmlRenderevent  
Event object type: flash.events.Event

Signals that the rendering of content in the HTMLControl object is fully up-to-date. This event can be dispatched quite frequently—whenever any rendering change is made to the HTML content. For example, this event is dispatched when new content is displayed as a result of a user clicking a link or when JavaScript in the page renders HTML. Event listeners may call any method or access any property of the HTMLControl.

Handlers of this event should check the htmlWidth and htmlHeight properties of the HTMLControl to update any scroll bars associated with the HTMLControl.

The HTMLControl object may dispatch this event any time after a load operation is initiated. The HTMLControl object may dispatch this event even after the object has dispatched the complete event.

locationChangeevent  
Event object type: flash.events.Event

Signals the location property of the HTMLControl object has changed. The event handler for this event may call any method or access any property of the HTMLControl object.

See also

scrollevent  
Event object type: flash.events.Event
Event.type property = flash.events.Event.SCROLL

Signals that the scrollH or scrollV property have been changed by the HTMLControl. The HTMLControl object dispatches this event when JavaScript running in the HTMLControl invokes the scrollTo() method of the window object and the desired location is not already visible. The event is not dispatched when ActionScript code changes the scrollH or scrollV property. Event handlers may call any method or access any property of the HTMLControl object.

Event handlers for this event should check the scrollH and scrollV properties to update any scroll bars associated with the HTMLControl object.

The HTMLControl object may dispatch this event any time after a load operation is initiated. The HTMLControl object may dispatch this event even after the object has dispatched the complete event.

Defines the value of the type property of a scroll event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe TextField object that has been scrolled. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event.
uncaughtJavaScriptExceptionevent  
Event object type: flash.events.HTMLUncaughtJavaScriptExceptionEvent

Signals that an uncaught JavaScript exception occurred in the HTMLControl. Event handlers may call any method or access any property of the HTMLControl object.

See also

Examples

The following code initializes an HTMLControl object, configures its width and height, loads the URL http://www.adobe.com, and adds the object to the display list:
package {
    import flash.display.Sprite;
    import flash.html.HTMLControl;
    import flash.net.URLRequest;

    public class HTMLControlExample extends Sprite
    {
        public function HTMLControlExample()
        {
            var html:HTMLControl = new HTMLControl();
            var urlReq:URLRequest = new URLRequest("http://www.adobe.com/");
            html.width = stage.stageWidth;
            html.height = stage.stageHeight;
            html.load(urlReq); 
            addChild(html);
        }
    }
}





collected by Jimbob 2007.05