
18 About Flash Asset Xtra for Flash Player 8
Parameters
targetDataFormat Required. A symbol value indicating the target data format for the
conversion process. The following values are supported:
#image (Lingo image object), #rect
(Lingo rect object),
#bitmapdata (ActionScript BitmapData object) and #rectangle
(ActionScript Rectangle object).
sourceDataRef Required. A reference to the source data to be converted. This parameter
must be a reference to a Lingo image object, a Lingo rect object, an ActionScript BitmapData
object or an ActionScript Rectangle object.
Example
The following statements convert a BitmapData object in a Flash sprite to a Director image
object so that the image can be used as a texture within a 3D world :
--Lingo syntax
tBmpData = sprite(12).getVariable("ImageData", false)
tImageObj = sprite(12).convert(#image, tBmpData)
tTexture = member("3D").newTexture("Flash
texture",#fromImageObject,tImageObj)
// JavaScript syntax
var tBmpData = sprite(12).getVariable("ImageData", false);
var tImageObj = sprite(12).convert(symbol("image"), tBmpData);
tTexture = member("3D").newTexture("Flash
texture",#fromImageObject,tImageObj);
The following statements convert the Director rect value to a Flash Rectangle object in the
global Flash-object space:
--Lingo syntax
tImageRect = member("Bitmap").image.rect;
tRectangle = convert(#rectangle, tImageRect);
// JavaScript syntax
var tImageRect = member("Bitmap").image.rect;
var tRectangle = convert(symbol("rectangle"), tImageRect
The convert() method only converts linear Lingo lists and normal Flash arrays; it does not
convert property lists, or associative arrays. Also, the
convert() method only operates on
Lingo lists, not on JavaScript arrays.
The following statements convert arrays and lists:
--Lingo syntax
trees = ["oak", "ash", "elm", "beech"]
flashtrees = convert(#flashObjectArray, trees)
put flashtrees.toString()
Kommentare zu diesen Handbüchern