Packagetwaver.network.ui
Classpublic class Attachment
InheritanceAttachment Inheritance mx.core.UIComponent
Subclasses BasicAttachment, EditAttachment, IconsAttachment

Attachment class defines an visible attachment for an element displayed on network canvas. Attachment is a separate graph element on an element ui used to display extra information or works as an indicator. Very often used attachments are like element label, element alarm bubble, small icons etc.

You can write a new subclass to create customized attachment. You can create attachment to display text, graphic, UIComponent, picture, GIF image, or even swf resource. However, class BasicAttachment implements most needed functions so it always a better idea to extends subclasses from class BasicAttachment.



Public Properties
 PropertyDefined By
  attachmentSprite : Sprite
Attachment
  attachmentSpriteTransform : Transform
Attachment
  bounds : Rectangle
[read-only] Get attachment bounds.
Attachment
  element : IElement
[read-only] Get element ui related element object.
Attachment
  elementUI : ElementUI
[read-only] Get connected element ui.
Attachment
  network : Network
[read-only] Get network component this attachment display on.
Attachment
  showInAttachmentCanvas : Boolean
[read-only] Get value whether show this attachment a the separate attachment canvas in network.
Attachment
Public Methods
 MethodDefined By
  
Attachment(elementUI:ElementUI, showInAttachmentCanvas:Boolean = false)
Attachment constructor.
Attachment
  
dispose():void
Call this to dispose all resources used by this attachment.
Attachment
  
draw(graphics:Graphics):void
Draw attachment content.
Attachment
  
setMatrix(matrix:Matrix):void
Set attachment transform matrix.
Attachment
  
Update attachment transparency.
Attachment
  
Update element attachment properties.
Attachment
Protected Methods
 MethodDefined By
  
Create filters.
Attachment
  
measure():void
[override]
Attachment
Property Detail
attachmentSpriteproperty
public var attachmentSprite:Sprite

attachmentSpriteTransformproperty 
public var attachmentSpriteTransform:Transform

boundsproperty 
bounds:Rectangle  [read-only]

Get attachment bounds.


Implementation
    public function get bounds():Rectangle
elementproperty 
element:IElement  [read-only]

Get element ui related element object.


Implementation
    public function get element():IElement
elementUIproperty 
elementUI:ElementUI  [read-only]

Get connected element ui.


Implementation
    public function get elementUI():ElementUI
networkproperty 
network:Network  [read-only]

Get network component this attachment display on.


Implementation
    public function get network():Network
showInAttachmentCanvasproperty 
showInAttachmentCanvas:Boolean  [read-only]

Get value whether show this attachment a the separate attachment canvas in network. See class Network to know more about the network internal canvas hierarchy. Because attachment canvas is in front of other canvas, so this attachment will not covered by other element body if set this value to true. Default value here is false.


Implementation
    public function get showInAttachmentCanvas():Boolean

See also

Constructor Detail
Attachment()Constructor
public function Attachment(elementUI:ElementUI, showInAttachmentCanvas:Boolean = false)

Attachment constructor. Create an attachment for specified element ui.

Parameters
elementUI:ElementUI — the element ui contains this attachment.
 
showInAttachmentCanvas:Boolean (default = false) — whether show this attachment a the separate attachment canvas in network. See class Network to know more about the network internal canvas hierarchy. Because attachment canvas is in front of other canvas, so this attachment will not covered by other element body if set this value to true. Default value here is false.

See also

Method Detail
createFilters()method
protected function createFilters():Array

Create filters.

Returns
Array — create filters in an array.
dispose()method 
public function dispose():void

Call this to dispose all resources used by this attachment.

draw()method 
public function draw(graphics:Graphics):void

Draw attachment content. Subclass should overwrite this function to draw own attachment content.

Parameters

graphics:Graphics — the graphics attachment will draw on.

measure()method 
override protected final function measure():void

setMatrix()method 
public function setMatrix(matrix:Matrix):void

Set attachment transform matrix.

Parameters

matrix:Matrix — attachment transform matrix.

updateAlpha()method 
public function updateAlpha():void

Update attachment transparency.

updateProperties()method 
public function updateProperties():void

Update element attachment properties. This will redraw attachment.