scrollRect (MovieClip.scrollRect property)
public scrollRect : Object
The
property allows you to quickly scroll movie clip content and have a window
scrollRect
viewing larger content. Text fields and complex content scroll much faster, because pixel level
copying is used to scroll data instead of regenerating the entire movie clip from vector data. To
see the performance gain, use
set to
cacheAsBitmap
The movie clip is cropped and scrolled with a specific width, height, and scrolling offsets. The
properties are stored in the movie clip's coordinate space and are scaled just like
scrollRect
the overall movie clip. The corner bounds of the cropped window on the scrolling movie clip
are the origin of the movie clip (0, 0) and the (
points are not centered around the origin but use the origin at the upper-left corner. A scrolled
movie clip always scrolls in whole pixel increments. If the movie clip is rotated 90 degrees and
you scroll it left and right (by setting the
If set to a flash.geom.Rectangle object, the movie clip is cropped to a certain size and scrolled.
Availability: ActionScript 1.0; Flash Player 8
Example
The following example sets up a MovieClip hiearchy (by calling the
function) and then sets a new Rectangle as the
import flash.geom.Rectangle;
var container:MovieClip = setUpContainer();
var window:Rectangle = new Rectangle(0, 0, 100, 40);
container.scrollRect = window;
function setUpContainer():MovieClip {
var mc:MovieClip = this.createEmptyMovieClip("container",
this.getNextHighestDepth());
mc._x = 50;
mc._y = 50;
mc.opaqueBackground = 0xCCCCCC;
var content:MovieClip = mc.createEmptyMovieClip("content",
mc.getNextHighestDepth());
var colors:Array = [0xFF0000, 0x0000FF];
var alphas:Array = [100, 100];
var ratios:Array = [0, 0xFF];
var matrix:Object = {a:150, b:0, c:0, d:0, e:150, f:0, g:150, h:150,
i:1};
content.beginGradientFill("linear", colors, alphas, ratios, matrix);
content.lineTo(300, 0);
content.lineTo(300, 300);
in conjunction with a movie clip that has
scrollRect
.
true
scrollRect.x
,
scrollWidth
scrollHeight
property), it scrolls up and down.
property.
scrollRect
) point. These
setUpContainer()
MovieClip
923
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?