User Guide

copyPixels() 271
Both the constrainV() and constrainH()s constrain only one axis each.
Parameters
intSpriteNum
Required. An integer that identifies the sprite whose vertical coordinates are
evaluated against
intPosn.
intPosn Required. An integer to be evaluated against by the vertical coordinates of the left and
right sides of the sprite identified by
intSpriteNum.
Example
These statements check the constrainV function for sprite 1 when it has top and bottom
coordinates of 40 and 60:
-- Lingo syntax
put(constrainV(1, 20)) -- 40
put(constrainV(1, 55)) -- 55
put(constrainV(1, 100)) -- 60
// JavaScript syntax
put(constrainV(1, 20)); // 40
put(constrainV(1, 55)); // 55
put(constrainV(1, 100)); // 60
This statement constrains a moveable slider (sprite 1) to the edges of a gauge (sprite 2) when the
mouse pointer moves past the edge of the gauge:
-- Lingo syntax
sprite(1).locV = _movie.constrainV(2, _mouse.mouseH)
// JavaScript syntax
sprite(1).locV = _movie.constrainV(2, _mouse.mouseH);
See also
constrainH(), Movie
copyPixels()
Usage
-- Lingo syntax
imageObjRef.copyPixels(sourceImgObj, destRectOrQuad, sourceRect {, paramList})
// JavaScript syntax
imageObjRef.copyPixels(sourceImgObj, destRectOrQuad, sourceRect {,
paramList});
Description
Image method. Copies the contents of a rectangle in an existing image object into a new
image object.
When copying pixels from one area of a cast member to another area of the same member, it is
best to copy the pixels first into a duplicate image object before copying them back into the
original member. Copying directly from one area to another in the same image is not
recommended.
To simulate matte ink with
copyPixels(), create a matte object with createMatte() and then
pass that object as the #maskImage parameter of copyPixels().