
About ActionScript image effects 15
The following example takes a Lingo image, converts it to an ActionScript BitmapData
object, applies an ActionScript blur effect to it, and renders it in Director as a 3D texture:
-- Get a Lingo image.
tImage = member("SomeImage").image.duplicate()
-- Create an ActionScript BlurFilter object. Note that the filter's
-- properties are default values. To specify non-default values,
-- pass additional parameters in the newObject() call.
tBlurFilter = newObject("flash.filters.BlurFilter")
-- Convert the image object to a BitmapData object.
tBitmapData = convert(#bitmapdata, tImage)
-- Apply the blur filter to the BitmapData object.
-- Trap the returned result value for error checking.
tResult = tBitmapData.applyFilter(tBitmapData, tBitmapData.Rectangle,
newObject("Point",0,0), tBlurFilter)
-- Use the returned result value to error check.
-- A value of zero indicates that no error occurred.
-- Negative values indicate that an error occurred.
if (tResult = 0) then
-- Convert the blurred BitmapData object back to a Lingo image object
tBlurryImg = convert(#image,tBitmapData)
-- Use the image object to create a new texture and apply it to a model in
the scene
tTexture = member("3D").newTexture("Box",#fromImageObject,tBlurryImg)
member("3D").model("Box").shader.texture = tTexture
end if
The following example pushes a Lingo image into a Flash sprite, converts the image to an
ActionScript BitmapData object, and renders the image in Flash:
-- Get a Lingo image
tImage = member("Some Image").image.duplicate()
-- Convert the image object to a BitmapData object
-- inside the Flash sprite that will render the image
tBitmapData = sprite("SWF").convert(#bitmapdata, tImage)
-- Attach the BitmapData object to a movie clip.
-- (Note: this example assumes that on the Stage in the SWF
-- is a movie clip instance named "MovieClip".)
-- (Note: there are additional optional parameters that
-- can be specified in the call to attachBitmap().)
sprite("SWF").MovieClip.attachBitmap(tBitmapData,1)
Comentarios a estos manuales