From 79670053c7247d3a49b607960efd284e93f057e5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:26 -0500 Subject: install.pl --- bPod/com/oop/UIButton.as | 171 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 bPod/com/oop/UIButton.as (limited to 'bPod/com/oop/UIButton.as') diff --git a/bPod/com/oop/UIButton.as b/bPod/com/oop/UIButton.as new file mode 100644 index 0000000..035c16c --- /dev/null +++ b/bPod/com/oop/UIButton.as @@ -0,0 +1,171 @@ + + +import com.oop.SelectionSystem; + +class com.oop.UIButton extends MovieClip +{ + +//-------------------------------------------------------------------------------------------- + + // Stores a reference to a SelectionSystem instance + private var selectionSystem:Object; + + // Numeric id passed in by SelectionSystem when attached + private var id:Number; + + + + + // Keeps track of the selection status of this clip + private var selected:Boolean; + + // Holds any custom visual information (such as title) + private var itemData:Object; + + // stores the history of this item + private var visited:Boolean; + + + + +//-------------------------------------------------------------------------------------------- +// constructor +//-------------------------------------------------------------------------------------------- + + public function UIButton() + { + } + +//-------------------------------------------------------------------------------------------- + + /* + Set up our reference, ID, and item data + then take care of the clip's ui + */ + public function init(_selectionSystem:SelectionSystem, _id:Number, _itemData:Object ):Void + { + selectionSystem = _selectionSystem; + itemData = _itemData; + id = _id; + _focusrect = false; + initMouseEvents(); + } + +//-------------------------------------------------------------------------------------------- + + /* + Select this clip. It will stay visually selected + because the mouse is rolled over it + */ + private function setSelected():Void + { + selected = visited = true; + killMouseEvents(); + } + +//-------------------------------------------------------------------------------------------- + + /* + Unselect this clip + */ + private function setUnselected():Void + { + selected = false; + initMouseEvents(); + } + +//-------------------------------------------------------------------------------------------- + + private function setTitle(_val:Object):Void + { + // override + } + +//-------------------------------------------------------------------------------------------- + + private function setPosition():Void + { + //override + } + +//-------------------------------------------------------------------------------------------- + + /* + Tell selectionSystem about the click and pass this clips ID with it + */ + private function handleRelease():Void + { + selectionSystem.setSelection(id); + } + +//-------------------------------------------------------------------------------------------- + + private function handlePress():Void + { + //override + } + +//-------------------------------------------------------------------------------------------- + + private function handleRollOver():Void + { + //override + } + +//-------------------------------------------------------------------------------------------- + + private function handleRollOut():Void + { + //override + } + +//-------------------------------------------------------------------------------------------- + + /* + Capture all of our mouse events and pass them + to the internal hander methods + */ + private function initMouseEvents() : Void + { + useHandCursor = false; + onRollOver = handleRollOver; + onRollOut = handleRollOut; + onReleaseOutside = handleRollOut; + onPress = handlePress; + onRelease = handleRelease; + } + +//-------------------------------------------------------------------------------------------- + + /* + Remove all mouse events while the clip is selected + */ + private function killMouseEvents():Void + { + useHandCursor = false; + delete onRollOver; + delete onRollOut; + delete onReleaseOutside; + delete this.onPress; + delete this.onRelease; + } + +//-------------------------------------------------------------------------------------------- +// Getter/Setters +//-------------------------------------------------------------------------------------------- + + public function getId():Number + { + return id; + } + +//-------------------------------------------------------------------------------------------- + + public function setId(_val:Number):Void + { + id = _val; + } + +//-------------------------------------------------------------------------------------------- + +} -- cgit v1.2.3-70-g09d2