WDTM: scrolling text

i tried to comment the code :slight_smile:


// the "scrollRect" is a property in the DisplayObject class,
//while "Rectangle" is a method in the Rectangle class, how the programmer
//knows that he needs this method to combine these togather.
bigText.scrollRect = new Rectangle(0, 0, bigText.width, 350);

bigText.cacheAsBitmap = true;
function scrollUp(event:MouseEvent):void {
    //What i understood here is: we created the "rect" with the  properties
    //of the bigText.
    var rect:Rectangle = bigText.scrollRect;
    rect.y -= 20;
    
    //i do not get it at all, we created the "rect" with the "bigText" properties
    //now, we reverse it?, os that right?
    //Tell me why
    bigText.scrollRect = rect;
}
function scrollDown(event:MouseEvent):void {
    var rect:Rectangle = bigText.scrollRect;
    rect.y += 20;
    bigText.scrollRect = rect;
}
up.addEventListener(MouseEvent.CLICK, scrollUp);
down.addEventListener(MouseEvent.CLICK, scrollDown);

Thanks