package com.exanimo.gallery { import com.exanimo.gallery.*; import com.exanimo.events.DataChangeEvent; import com.exanimo.events.DataChangeType; import flash.display.*; import flash.events.Event; /** * * .. * * @langversion ActionScript 3 * @playerversion Flash 9.0.0 * * @author Eric Eldredge * @author Rich Perez * @author Matthew Tretter * @since 2009.01.12 * */ public class GallerySprite extends Sprite implements IGallery, IGalleryView { private var _controller:IGalleryController; /** * * */ public function GallerySprite() { } // // accessors // /** * @inheritDoc */ public function get controller():IGalleryController { return this._controller; } /** * @private */ public function set controller(controller:IGalleryController):void { if (this._controller) { this._controller.removeEventListener(GalleryEvent.SELECTED_ITEM_CHANGE, this._relayEvent); } this._controller = controller; if (controller) { controller.addEventListener(GalleryEvent.SELECTED_ITEM_CHANGE, this._relayEvent); } } /** * * * */ public function get numItems():uint { return this._controller.numItems; } /** * * * */ public function get selectedItemIndex():int { return this._controller.selectedItemIndex; } /** * @inheritDoc */ public function bindSelectedItem(gallery:IGallery):void { this._controller.bindSelectedItem(gallery); } /** * @inheritDoc */ public function unbindSelectedItem(gallery:IGallery):void { this._controller.unbindSelectedItem(gallery); } // // public methods // /** * @inheritDoc */ public function selectItemAt(index:uint):void { this._controller.selectItemAt(index); } /** * @inheritDoc */ public function clearSelection():void { this._controller.clearSelection(); } // // private methods // /** * * */ private function _relayEvent(e:GalleryEvent):void { this.dispatchEvent(e); } } }