package { import com.exanimo.containers.IScrollPane; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; import flash.text.TextField; import flash.text.TextFieldAutoSize; public class ScrollPaneExample3 extends Sprite { public var scrollPaneContent:Sprite; /** * * * */ public function ScrollPaneExample3() { this.needsUpdateIndicator.visible = false; // Set the ScrollPane's source to an empty Sprite. this.scrollPaneContent = new Sprite(); this.scrollPane.source = this.scrollPaneContent; // Configure button handlers. this.addItemButton.addEventListener(MouseEvent.CLICK, this.addItem); this.removeItemButton.addEventListener(MouseEvent.CLICK, this.removeItem); this.updateButton.addEventListener(MouseEvent.CLICK, this.update); } /** * * Add an item to the ScrollPane. * */ public function addItem(e:MouseEvent):void { var item:Sprite = new Item(); item.y = this.scrollPaneContent.numChildren * item.height; this.scrollPaneContent.addChild(item); this.needsUpdateIndicator.visible = true; } /** * * Remove an item from the ScrollPane * */ public function removeItem(e:MouseEvent):void { if (this.scrollPaneContent.numChildren) { this.scrollPaneContent.removeChildAt(this.scrollPaneContent.numChildren - 1); this.needsUpdateIndicator.visible = true; } } /** * * Update the ScrollPane * */ public function update(e:MouseEvent):void { this.scrollPane.update(); this.needsUpdateIndicator.visible = false; } } }