An event that is dispatched for a change to either a schema field value or a schema prefix value.
IAttachment
Property Detail
children
property
children:IList [read-only]
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Children of this IAttachment.
It will be null if this IAttachment is not a folder (for example, if
isFolder is false).
Otherwise this is an ordered list (possibly empty) of non-nullIAttachment instances.
In this case the IList is read-only; attempts to modify it will generate exceptions.
Implementation public function get children():IList
See also
mx.collections.IList
compressedSize
property
compressedSize:uint [read-only]
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
The compressed size (in bytes) of the file.
This property can be used as the source for data binding.
Implementation public function get compressedSize():uint
creationDate
property
creationDate:Date [read-only]
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
The creation date of the file. The creation date
will never change, so there is no change event associated with
this property.
Implementation public function get creationDate():Date
dataUrl
property
dataUrl:String [read-only]
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Returns a url that can be used to load the contents of the attachment file.
This property can be used as the source for data binding.
Implementation public function get dataUrl():String
description
property
description:String
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Sets or gets the file description.
This property can be used as the source for data binding.
Implementation public function get description():String public function set description(value:String):void
Throws
Error
— An Error is thrown if the file description is set
when the permission "EmbeddedFile"/"Modify" has not been granted.
The value must be either null or an
IAttachment that represents a folder. A value of
null indicates that this IAttachment is
located at the root level of the collection's folder hierarchy.
This property can be used as the source for data binding.
Implementation public function get parent():IAttachment public function set parent(value:IAttachment):void
Throws
Error
— An Error is thrown if the value is set to an
IAttachment that is not a folder,
or if the value is set when the permission
"EmbeddedFile"/"Modify" has not been granted.
This property can be used as the source for data binding.
Implementation public function get path():String
size
property
size:uint [read-only]
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Gets the uncompressed size (in bytes) of the file.
This property can be used as the source for data binding.
Implementation public function get size():uint
Method Detail
getFieldPrefix
()
method
public function getFieldPrefix(fieldName:String):String
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Retrieves the prefix for a particular field.
A field can have a prefix that is not part of the value,
but should be presented to the user as if it were. For example, consider an email
archive containing subjects with the prefixes "FWD: " or "RE: ". In one case (display)
the prefix and the value should be concatenated. In another case (sort comparison) the prefix
should be ignored.
Parameters
fieldName:String — The name of the field for which to return the prefix.
Returns
String — The value of the field prefix; it returns "" (an empty String) if there is
no prefix. It returns undefined if the field is not part of the collection schema.
getFieldStyledText
()
method
public function getFieldStyledText(fieldName:String):XML
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
For some string field in the collection schema, this function retrieves the IAttachment instance's
XML-coded value for that field.
A change to the value of a schema property will dispatch a FieldValueChangeEvent.
The name of the schema property that changed will be stored in FieldValueChangeEvent.fieldName.
Parameters
fieldName:String — The name of the field.
Returns
XML — The string field's XML-encoded value as Text Layout Format
For some field in the collection schema, this function retrieves the IAttachment instance's
value for that field.
A change to the value of a schema property will dispatch a FieldValueChangeEvent.
The name of the schema property that changed will be stored in
FieldValueChangeEvent.fieldName.
Parameters
fieldName:String — The name of the field.
Returns
* — The field value. Depending on the field type, this will be a String, Number or Date.
It returns undefined if the field is not part of the collection schema.
public function requestCachedThumbnail(id:*, callback:Function):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Requests the attachment thumbnail that is cached in the portfolio
document. In PDF files the cached thumbnail is stored in the
attachment's /Thumb dictionary.
Cached thumbnails, when they exist, can typically be returned
much more quickly than a bitmap can be generated using
requestPageThumbnail().
Cached thumbnail images are generally small, although there is
no guarantee as to what specific dimensions they will have.
If there is no cached thumbnail, this method returns a null Bitmap.
The Bitmap is returned via the provided callback function.
The callback has the following signature:
function(id:*, bitmap:Bitmap):void
where bitmap is the requested thumbnail.
The callback function is guaranteed to be called exactly once.
It is guaranteed to be called asynchronously (outside the scope of
this method).
Parameters
id:* — Arbitrary data passed by the caller, typically used to identify the request.
callback:Function — Callback function as described above.
requestPageThumbnail
()
method
public function requestPageThumbnail(id:*, pageNumber:uint, width:uint, height:uint, callback:Function):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Requests a thumbnail image for a specific attachment page at a
specified size. This generates a new bitmap dynamically.
This typically takes much longer to return a bitmap than
requestPageThumbnail().
At least one dimension in the Bitmap will exactly match the request.
Neither dimension will exceed the requested size. In the case where
one dimension is smaller than requested, it's value will be chosen
so as to preserve the content aspect ratio as closely as possible.
If the implementation cannot produce pixels for any reason (unsupported
format; can't render requested size; errors; etc.) it returns a null Bitmap.
The Bitmap is returned via the provided callback function.
The callback has the following signature:
where id, width and height
are the corresponding arguments from the method call, and
bitmap is the requested thumbnail.
The callback function is guaranteed to be called exactly once.
It is guaranteed to be called asynchronously (outside the scope of
this method).
Parameters
id:* — Arbitrary data passed by the caller, typically used to identify the
request.
pageNumber:uint — The attachment page number for the thumbnail, It must be > 0 and <= 2048.
width:uint — The width of the thumbnail, in pixels. It must be > 0 and <= 2048.
height:uint — The height of the thumbnail, in pixels. It must be > 0 and <= 2048.
callback:Function — Callback function as described above.
setFieldPrefix
()
method
public function setFieldPrefix(fieldName:String, value:String):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Sets the prefix for a particular field.
Parameters
fieldName:String — The name of the field for which to return the prefix.
value:String — The value of the field prefix; "" (an empty String) if there is no prefix.
Throws
Error —
An Error is thrown if the
fieldName argument refers to a non-existent field
(that is, a field not in the schema, as reported by ICollection.fields).
In addition, an Error is thrown if the field maps to
a read-only IAttachment property (that is, the IField
has a type of CREATION_DATE,
MOD_DATE, COMPRESSED_SIZE, or SIZE). No error is thrown if
the field maps to a writable IAttachment property (the
IField has an type of DESCRIPTION or
FILE_NAME). In addition, an Error is thrown if
this method is called when the permission "EmbeddedFile"/"Modify" has not been granted.
public function setFieldValue(fieldName:String, value:*):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 9.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Sets the value of a specified field in an IAttachment.
Parameters
fieldName:String — The name of the field.
value:* — The field's new value. Depending on the field type, this will be
a String, Number, Date, or XML.
If the value is XML, then the field is set as styled text, which only applies to
a string-typed field. The XML must be in Text Layout Markup.
Throws
Error —
An Error is thrown if the
fieldName argument refers to a non-existent field
(that is, a field not in the schema, as reported by ICollection.fields).
In addition, an Error is thrown if the field maps to
a read-only IAttachment property (that is, the IField
has an type of CREATION_DATE,
MOD_DATE, COMPRESSED_SIZE, or SIZE). No error is thrown if
the field maps to a writable IAttachment property (the
IField has an type of DESCRIPTION or
FILE_NAME).
Also, an Error is thrown if this method is
called when the permission "EmbeddedFile"/"Modify" has not been granted.
public function writeData(buffer:ByteArray, response:Function = null):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Replaces the contents of the file attachment
This operation is only allowed when the permission
"Document"/"Modify" has been granted. A SWF file may not be uploaded.
The maximum length of the ByteArray accepted by this method is 1,048,576 bytes.
Accepts an optional callback function as an argument.
When it is non-null, the callback function is invoked to indicate the result of the operation.
The callback function receives a single argument, an Object, and has the following signature:
function callback(response:Object):void
The response parameter contains properties that describe the response.
These include:
Property
Type
Value
'success'
Boolean
true if the operation succeeded; false otherwise.
'error'
String
A non-human-readable String describing the error.
It is non-null only if success is false.
Parameters
buffer:ByteArray — The byte array that contains the buffer that will be written to the file.
response:Function (default = null) — An optional notification function, as described above.
Throws
Error
— An Error is thrown if the
permission "Document"/"Modify" has not been granted.