Packageflashx.textLayout.elements
Classpublic final class InlineGraphicElement
InheritanceInlineGraphicElement Inheritance FlowLeafElement Inheritance FlowElement Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The InlineGraphicElement class handles graphic objects that display inline in the text.

You can embed a graphic or any DisplayObject or specify a URl for the location of the graphic. The height and width properties of InlineGraphicElement control the actual size of the graphic to display. These values also control how much space to allocate for the graphic in the TextLine object that contains the graphic. The height and width properties each can be one of:

  1. A number of pixels
  2. A percent of the measured size of the image
  3. The constant, "auto", which computes the size (Default value)
There are three properties, or accessors, pertaining to the width and height of a graphic:

The values of the actualWidth and actualHeight properties are always zero until the graphic is loaded.

If source is specified as a URI, the graphic is loaded asynchronously. If it's a DisplayObject, TextLayout uses the width and height at the time the graphic is set into the InlineGraphicElement object as measuredHeight and measuredWidth; its width and height are read immediately.

Notes: For graphics that are loaded asynchronously the user must listen for a StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE event on the TextFlow and call IFlowComposer.updateAllControllers() to have the graphic appear. The value of measuredWidth and measuredHeight for graphics that are in the process of loading is zero.

Some inline graphics are animations or videos that possibly have audio. They begin to run the first time they are composed after they finish loading. They don't stop running until the flowComposer on the TextFlow is set to null. At that time they are stopped and unloaded.

View the examples

See also

actualHeight
actualWidth
DisplayObject
flashx.textLayout.compose.IFlowComposer.updateAllControllers()
StatusChangeEvent
TextFlow


Public Properties
 PropertyDefined By
  actualHeight : Number
[read-only] The actual height in effect.
InlineGraphicElement
  actualWidth : Number
[read-only] The actual width in effect.
InlineGraphicElement
 InheritedalignmentBaseline : *
TextLayoutFormat: Specifies the baseline to which the dominant baseline aligns.
FlowElement
 InheritedbackgroundAlpha : *
TextLayoutFormat: Alpha (transparency) value for the background (adopts default value if undefined during cascade).
FlowElement
 InheritedbackgroundColor : *
TextLayoutFormat: Background color of the text (adopts default value if undefined during cascade).
FlowElement
 InheritedbaselineShift : *
TextLayoutFormat: Amount to shift the baseline from the dominantBaseline value.
FlowElement
 InheritedblockProgression : *
TextLayoutFormat: Specifies a vertical or horizontal progression of line placement.
FlowElement
 InheritedbreakOpportunity : *
TextLayoutFormat: Controls where lines are allowed to break when breaking wrapping text into multiple lines.
FlowElement
 InheritedcffHinting : *
TextLayoutFormat: The type of CFF hinting used for this text.
FlowElement
 Inheritedcolor : *
TextLayoutFormat: Color of the text.
FlowElement
 InheritedcolumnCount : *
TextLayoutFormat: Number of text columns (adopts default value if undefined during cascade).
FlowElement
 InheritedcolumnGap : *
TextLayoutFormat: Specifies the amount of gutter space, in pixels, to leave between the columns (adopts default value if undefined during cascade).
FlowElement
 InheritedcolumnWidth : *
TextLayoutFormat: Column width in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedcomputedFormat : flashx.textLayout.formats:ITextLayoutFormat
[override] [read-only] Returns the computed character format attributes that are in effect for this element.
FlowLeafElement
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcoreStyles : Object
[read-only] Returns the core styles on a FlowElement instance.
FlowElement
 InheriteddigitCase : *
TextLayoutFormat: The type of digit case used for this text.
FlowElement
 InheriteddigitWidth : *
TextLayoutFormat: Type of digit width used for this text.
FlowElement
 Inheriteddirection : *
TextLayoutFormat: Specifies the default bidirectional embedding level of the text in the text block.
FlowElement
 InheriteddominantBaseline : *
TextLayoutFormat: Specifies which element baseline snaps to the alignmentBaseline to determine the vertical position of the element on the line.
FlowElement
 InheritedfirstBaselineOffset : *
TextLayoutFormat: Specifies the baseline position of the first line in the container.
FlowElement
 InheritedfontFamily : *
TextLayoutFormat: The name of the font to use, or a comma-separated list of font names.
FlowElement
 InheritedfontLookup : *
TextLayoutFormat: Font lookup to use.
FlowElement
 InheritedfontSize : *
TextLayoutFormat: The size of the text in pixels.
FlowElement
 InheritedfontStyle : *
TextLayoutFormat: Style of text.
FlowElement
 InheritedfontWeight : *
TextLayoutFormat: Weight of text.
FlowElement
 Inheritedformat : flashx.textLayout.formats:ITextLayoutFormat
TextLayoutFormat properties applied directly to this element.
FlowElement
  graphic : DisplayObject
[read-only] The embedded graphic.
InlineGraphicElement
  height : Object
The height of the image.
InlineGraphicElement
 Inheritedid : String
Assigns an identifying name to the element, making it possible to set a style for the element by referencing the id.
FlowElement
 InheritedjustificationRule : *
TextLayoutFormat: Rule used to justify text in a paragraph.
FlowElement
 InheritedjustificationStyle : *
TextLayoutFormat: The style used for justification of the paragraph.
FlowElement
 Inheritedkerning : *
TextLayoutFormat: Kerning adjusts the pixels between certain character pairs to improve readability.
FlowElement
 InheritedleadingModel : *
TextLayoutFormat: Specifies the leading model, which is a combination of leading basis and leading direction.
FlowElement
 InheritedligatureLevel : *
TextLayoutFormat: Controls which of the ligatures that are defined in the font may be used in the text.
FlowElement
 InheritedlineBreak : *
TextLayoutFormat: Controls word wrapping within the container (adopts default value if undefined during cascade).
FlowElement
 InheritedlineHeight : *
TextLayoutFormat: Leading controls for the text.
FlowElement
 InheritedlineThrough : *
TextLayoutFormat: If true, applies strikethrough, a line drawn through the middle of the text.
FlowElement
 InheritedlinkActiveFormat : *
equivalent to setStyle(linkActiveFormat,value).
FlowElement
 InheritedlinkHoverFormat : *
equivalent to setStyle(linkHoverFormat,value).
FlowElement
 InheritedlinkNormalFormat : *
equivalent to setStyle(linkNormalFormat,value).
FlowElement
 Inheritedlocale : *
TextLayoutFormat: The locale of the text.
FlowElement
  measuredHeight : Number
[read-only] The natural height of the graphic.
InlineGraphicElement
  measuredWidth : Number
[read-only] The natural width of the graphic.
InlineGraphicElement
 InheritedpaddingBottom : *
TextLayoutFormat: Botttom inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedpaddingLeft : *
TextLayoutFormat: Left inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedpaddingRight : *
TextLayoutFormat: Right inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedpaddingTop : *
TextLayoutFormat: Top inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedparagraphEndIndent : *
TextLayoutFormat: A Number that specifies, in pixels, the amount to indent the paragraph's end edge.
FlowElement
 InheritedparagraphSpaceAfter : *
TextLayoutFormat: A Number that specifies the amount of space, in pixels, to leave after the paragraph.
FlowElement
 InheritedparagraphSpaceBefore : *
TextLayoutFormat: A Number that specifies the amount of space, in pixels, to leave before the paragraph.
FlowElement
 InheritedparagraphStartIndent : *
TextLayoutFormat: A Number that specifies, in pixels, the amount to indent the paragraph's start edge.
FlowElement
 Inheritedparent : FlowGroupElement
[read-only] Returns the parent of this FlowElement object.
FlowElement
 InheritedparentRelativeEnd : int
[read-only] Returns the relative end of this FlowElement object in the parent.
FlowElement
 InheritedparentRelativeStart : int
[read-only] Returns the relative start of this FlowElement object in the parent.
FlowElement
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 InheritedrenderingMode : *
TextLayoutFormat: The rendering mode used for this text.
FlowElement
  source : Object
Sets the source for the graphic.
InlineGraphicElement
  status : String
[read-only] The current status of the image.
InlineGraphicElement
 InheritedstyleName : String
FlowElement
 InheritedtabStops : *
TextLayoutFormat: Specifies the tab stops associated with the paragraph.
FlowElement
 Inheritedtext : String
[read-only] The text associated with the FlowLeafElement: The value for SpanElement subclass will be one character less than textLength if this is the last span in a ParagraphELement. The value for BreakElement subclass is a U+2028 The value for TabElement subclass is a tab The value for InlineGraphicElement subclass is U+FDEF
FlowLeafElement
 InheritedtextAlign : *
TextLayoutFormat: Alignment of lines in the paragraph relative to the container.
FlowElement
 InheritedtextAlignLast : *
TextLayoutFormat: Alignment of the last (or only) line in the paragraph relative to the container in justified text.
FlowElement
 InheritedtextAlpha : *
TextLayoutFormat: Alpha (transparency) value for the text.
FlowElement
 InheritedtextDecoration : *
TextLayoutFormat: Decoration on text.
FlowElement
 InheritedtextIndent : *
TextLayoutFormat: A Number that specifies, in pixels, the amount to indent the first line of the paragraph.
FlowElement
 InheritedtextJustify : *
TextLayoutFormat: Specifies options for justifying text.
FlowElement
 InheritedtextLength : int
[read-only] Returns the total length of text owned by this FlowElement object and its children.
FlowElement
 InheritedtextRotation : *
TextLayoutFormat: Determines the number of degrees to rotate this text.
FlowElement
 Inheritedtracking : Object
[write-only] Sets the tracking and is synonymous with the trackingRight property.
FlowElement
 InheritedtrackingLeft : *
TextLayoutFormat: Number in pixels (or percent of fontSize, like 120%) indicating the amount of tracking (manual kerning) to be applied to the left of each character.
FlowElement
 InheritedtrackingRight : *
TextLayoutFormat: Number in pixels (or percent of fontSize, like 120%) indicating the amount of tracking (manual kerning) to be applied to the right of each character.
FlowElement
 InheritedtypographicCase : *
TextLayoutFormat: The type of typographic case used for this text.
FlowElement
 InheriteduserStyles : Object
Allows you to read and write user styles on a FlowElement object.
FlowElement
 InheritedverticalAlign : *
TextLayoutFormat: Vertical alignment or justification (adopts default value if undefined during cascade).
FlowElement
 InheritedwhiteSpaceCollapse : *
TextLayoutFormat: Collapses or preserves whitespace when importing text into a TextFlow.
FlowElement
  width : Object
The width of the graphic.
InlineGraphicElement
Public Methods
 MethodDefined By
  
Constructor - create new InlineGraphicElement object
InlineGraphicElement
 Inherited
Clears the style specified by the styleProp parameter from this FlowElement object.
FlowElement
 Inherited
deepCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a deep copy of this FlowElement object, including any children, copying the content between the two specified character positions and returning the copy as a FlowElement object.
FlowElement
 Inherited
Compare the userStyles of this with elem.
FlowElement
 Inherited
Returns the start location of the element in the text flow as an absolute index.
FlowElement
 Inherited
getCharAtPosition(relativePosition:int):String
Returns the character at the specified position, relative to this FlowElement object.
FlowElement
 Inherited
getCharCodeAtPosition(relativePosition:int):int
Returns the character code at the specified position, relative to this FlowElement.
FlowElement
 Inherited
Returns the FontMetrics object for the span.
FlowLeafElement
 Inherited
Returns the start of this element relative to an ancestor element.
FlowElement
 Inherited
Returns the next FlowLeafElement object.
FlowLeafElement
 Inherited
Returns the next FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
Returns the ParagraphElement object associated with this element.
FlowElement
 Inherited
Returns the previous FlowLeafElement object.
FlowLeafElement
 Inherited
Returns the previous FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
getStyle(styleProp:String):*
Returns the value of the style specified by the styleProp parameter, which specifies the style name and can include any user style name.
FlowElement
 Inherited
Climbs the text flow hierarchy to return the root TextFlow object for the element.
FlowElement
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
setStyle(styleProp:String, newValue:*):void
Sets the style specified by the styleProp parameter to the value specified by the newValue parameter.
FlowElement
 Inherited
shallowCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a copy of this FlowElement object, copying the content between two specified character positions.
FlowElement
 Inherited
splitAtPosition(relativePosition:int):FlowElement
Splits this FlowElement object at the position specified by the relativePosition parameter, which is a relative position in the text for this element.
FlowElement
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail
actualHeightproperty
actualHeight:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The actual height in effect. This is the display and compose height that's computed from the height and measuredHeight properties.

The values of the actualHeight property are computed according to the following table:

height propertyactualHeight
automeasuredheight
h a Percenth percent of measuredheight
h a Numberh

Notes: If the inline graphic is a DisplayObject, its width and height are read immmediately. If measuredWidth or measuredHeight are zero, then any auto calculations that would cause a divide by zero sets the result to zero.



Implementation
    public function get actualHeight():Number

See also

actualWidthproperty 
actualWidth:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The actual width in effect. This is the display and compose width that's computed from the width and measuredWidth properties.

The values of the actualWidthproperty are computed according to the following table:

width propertyactualWidth
automeasuredWidth
w a Percentw percent of measuredWidth
w a Numberw

Notes: If the inline graphic is a DisplayObject, its width and height are read immediately. If measuredWidth or measuredHeight are zero, then any auto calculations that would cause a divide by zero sets the result to zero.



Implementation
    public function get actualWidth():Number

See also

graphicproperty 
graphic:DisplayObject  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The embedded graphic.



Implementation
    public function get graphic():DisplayObject
heightproperty 
height:Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The height of the image. May be 'auto', a number of pixels or a percent of the measured height.



Implementation
    public function get height():Object
    public function set height(value:Object):void

See also

measuredHeightproperty 
measuredHeight:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The natural height of the graphic. This is the height of the graphic at load time.



Implementation
    public function get measuredHeight():Number

See also

measuredWidthproperty 
measuredWidth:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The natural width of the graphic. This is the width of the graphic at load time.



Implementation
    public function get measuredWidth():Number

See also

sourceproperty 
source:Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Sets the source for the graphic. The value can be either a String that is interpreted as a URI, a Class that's interpreted as the class of an embeddded DisplayObject, a DisplayObject instance, or a URLRequest. Creates a DisplayObject and, if the InlineGraphicElement object is added into a ParagraphElement in a TextFlow object, causes it to appear inline in the text.



Implementation
    public function get source():Object
    public function set source(value:Object):void

Example  ( How to use this example )
This example displays a span of text followed by an InlineGraphicElement object.

// create a container and a controller for it
var container:Sprite = new Sprite();
this.stage.addChild(container);
// create the TextFlow, ParagraphElement, SpanElement, and InlineGraphicElement objects    
var textFlow:TextFlow = new TextFlow();
var p:ParagraphElement = new ParagraphElement();
var inlineGraphicElement:InlineGraphicElement = new InlineGraphicElement();
var span:SpanElement = new SpanElement();
// add the graphic
inlineGraphicElement.source = drawRect();
// add text to the spans, spans and graphic to paragraph        
span.text = "Too much depends upon a ";
span.fontSize = 48;
p.addChild(span); 
p.addChild(inlineGraphicElement);
// add paragraph to text flow and update controller to display
textFlow.addChild(p);
textFlow.flowComposer = new StandardFlowComposer();
var controller:ContainerController = new ContainerController(container, 400, 300 );
textFlow.flowComposer.addController(controller);
textFlow.flowComposer.updateAllControllers(); 
public function drawRect():Sprite
{
    var redRect:Sprite = new Sprite();
    redRect.graphics.beginFill(0xff0000);    // red
    redRect.graphics.drawRect(0,0,30, 30);
    redRect.graphics.endFill();
    return redRect;
}
statusproperty 
status:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The current status of the image. On each status change the owning TextFlow sends a StatusChangeEvent.



Implementation
    public function get status():String

See also

widthproperty 
width:Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The width of the graphic. The value can be 'auto', a number of pixels or a percent of the measured width of the image.



Implementation
    public function get width():Object
    public function set width(value:Object):void

See also

Constructor Detail
InlineGraphicElement()Constructor
public function InlineGraphicElement()

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructor - create new InlineGraphicElement object

Examples (  How to use this example  )
InlineGraphicElementExample.as

This example displays an inline graphic element between two spans of text.

// create a container and a controller for it
var container:Sprite = new Sprite();
this.stage.addChild(container);
var controller:ContainerController = new ContainerController(container, 400, 200 );
// create the TextFlow, ParagraphElement, SpanElement, and InlineGraphicElement objects    
var textFlow:TextFlow = new TextFlow();
var p:ParagraphElement = new ParagraphElement();
var span1:SpanElement = new SpanElement();
var span2:SpanElement = new SpanElement();
var inlineGraphicElement:InlineGraphicElement = new InlineGraphicElement();
// add the graphic
inlineGraphicElement.source = drwCircle();
// add text to the spans, spans and graphic to paragraph        
span1.text = "You can draw a happy face here ";
span2.text = " if you like."
p.fontSize = 16;
p.addChild(span1);
p.addChild(inlineGraphicElement);
p.addChild(span2); 
// add paragraph to text flow and update controller to display
textFlow.addChild(p);
textFlow.flowComposer = new StandardFlowComposer();
textFlow.flowComposer.addController(controller);
textFlow.flowComposer.updateAllControllers(); 
        
// draw a yellow circle for the graphic element
public function drwCircle():Sprite
{
    var yellowCircle:Sprite = new Sprite();
    yellowCircle.graphics.beginFill(0xFFFF33);    // yellow
    yellowCircle.graphics.drawCircle(10,12,10);
    yellowCircle.graphics.endFill();
    return yellowCircle;
}